/* ==========================
   Chat Widget Styles
   ========================== */

/* Floating toggle button */
.chat-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #5c6bc0;
  color: white;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 22px;
  cursor: pointer;
  z-index: 10000;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  animation: float 2s ease-in-out infinite;
}

/* Floating animation */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* Tooltip bubble near toggle */
.chat-tooltip {
  position: fixed;
  bottom: 90px; 
  right: 80px; 
  background: #6a5acd;
  color: #fff;
  padding: 10px 15px;
  border-radius: 25px;
  font-size: 14px;
  font-weight: bold;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  animation: fadeInUp 0.8s ease;
  z-index: 999;
}

/* Tooltip arrow */
.chat-tooltip::after {
  content: "";
  position: absolute;
  bottom: -8px;
  right: 20px;
  border-width: 8px;
  border-style: solid;
  border-color: #6a5acd transparent transparent transparent;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ==========================
   Chat Container
   ========================== */
.chat-container {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 300px;
  height: 400px;
  background: #f0f4ff; /* light blue background */
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
  display: none; 
  flex-direction: column;
  z-index: 9999;
  overflow: hidden;
  font-family: Arial, sans-serif;
}

.chat-container.active {
  display: flex;
}

/* Header */
.chat-container header {
  background-color: #5c6bc0;
  color: white;
  padding: 10px;
  text-align: center;
  font-weight: bold;
  font-size: 15px;
  position: relative;
}

/* Clear button in header */
.clear-btn {
  position: absolute;
  right: 10px;
  top: 6px;
  background: transparent;
  border: none;
  color: white;
  font-size: 16px;
  cursor: pointer;
}
.clear-btn:hover { color: #ffdddd; }

/* ==========================
   Chat Messages
   ========================== */
.chat-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start; 
  gap: 6px;
  padding: 10px;
  overflow-y: auto;
  font-size: 14px;
}

/* Base bubble */
.message {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.4;
  box-sizing: border-box;
  animation: fadeInMsg 0.25s ease-out both;
}

/* Bot message (left) */
.message.bot {
  background: #e9ecef;
  color: #333;
  align-self: flex-start;
  border-radius: 18px 18px 18px 6px;
  text-align: left;
}

/* User message (right) */
.message.user {
  background: #cfe3ff; 
  color: #093a7a;
  align-self: flex-end;
  border-radius: 18px 18px 6px 18px;
  text-align: right;
}

/* Special greeting */
.message.bot.special-greeting {
  background: linear-gradient(135deg, #6a5acd, #00bcd4);
  color: #fff;
  font-weight: bold;
  border-radius: 30px;
  padding: 12px 18px;
  text-align: center;
  margin: 10px auto;
  max-width: 80%;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  animation: popIn 0.5s ease-in-out;
}

@keyframes popIn {
  from { transform: scale(0.8); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

@keyframes fadeInMsg {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ==========================
   Input Form
   ========================== */
#chatForm {
  display: flex;
  border-top: 1px solid #ccc;
}
#chatForm input[type="text"] {
  flex: 1;
  padding: 10px;
  border: none;
  font-size: 14px;
  outline: none;
}
#chatForm button {
  background-color: #5c6bc0;
  color: white;
  border: none;
  padding: 10px 15px;
  cursor: pointer;
  font-size: 14px;
}
#chatForm button:hover {
  background-color: #3f51b5;
}
/* ==========================
   Dark Mode Support
   ========================== */

body.dark-mode .chat-container {
  background: #1e1e2f;
  color: #ddd;
}

body.dark-mode .chat-container header {
  background-color: #333a7a;
  color: #fff;
}

body.dark-mode .chat-box {
  background: #1e1e2f;
}

body.dark-mode .message.bot {
  background: #2e2e40;
  color: #e0e0e0;
}

body.dark-mode .message.user {
  background: #4c5bd4;
  color: #fff;
}

body.dark-mode .message.bot.special-greeting {
  background: linear-gradient(135deg, #4c5bd4, #1db9c3);
  color: #fff;
}

body.dark-mode #chatForm {
  border-top: 1px solid #444;
}

body.dark-mode #chatForm input[type="text"] {
  background: #2e2e40;
  color: #fff;
}

body.dark-mode #chatForm button {
  background: #4c5bd4;
}
body.dark-mode #chatForm button:hover {
  background: #3949ab;
}

body.dark-mode .chat-tooltip {
  background: #4c5bd4;
}
body.dark-mode .chat-tooltip::after {
  border-color: #4c5bd4 transparent transparent transparent;
}
.theme-btn {
  position: absolute;
  right: 40px; /* keeps space between moon and trash */
  top: 6px;
  background: transparent;
  border: none;
  color: white;
  font-size: 16px;
  cursor: pointer;
}
.theme-btn:hover {
  color: #ffeb3b; /* yellow hover glow */
}

/* Smooth transition between light/dark */
.chat-container,
.chat-container header,
.message,
#chatForm,
#chatForm input,
#chatForm button {
  transition: background 0.3s, color 0.3s;
}
