/* ============================================
   SURJET CHATBOT WIDGET v2 - Production CSS
   ============================================ */

/* ---- LAUNCHER BUTTON ---- */
#chatbot-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #0047BA;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transition: transform 0.2s, box-shadow 0.2s;
  z-index: 10000;
}
#chatbot-launcher:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}
#chatbot-launcher svg {
  width: 28px;
  height: 28px;
  fill: #fff;
}
#chatbot-launcher.open svg.icon-chat { display: none; }
#chatbot-launcher:not(.open) svg.icon-close { display: none; }

/* ---- GREETING BUBBLE ---- */
#chatbot-greeting {
  position: fixed;
  bottom: 92px;
  right: 24px;
  background: #fff;
  color: #33475b;
  padding: 12px 18px;
  border-radius: 12px 12px 4px 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  max-width: 260px;
  z-index: 10000;
  cursor: pointer;
  animation: greetSlideUp 0.4s ease-out;
  transition: opacity 0.2s;
}
#chatbot-greeting:hover {
  box-shadow: 0 6px 20px rgba(0,0,0,0.16);
}
#chatbot-greeting .close-greeting {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #cbd6e2;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #fff;
  line-height: 1;
}
#chatbot-greeting .close-greeting:hover {
  background: #99acc2;
}
#chatbot-greeting.hidden {
  display: none;
}
@keyframes greetSlideUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- CHAT WINDOW ---- */
#chatbot-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 376px;
  max-height: 520px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 5px 40px rgba(0,0,0,0.16);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 10000;
  animation: chatSlideUp 0.25s ease-out;
}
#chatbot-window.visible {
  display: flex;
}
@keyframes chatSlideUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- HEADER ---- */
#chatbot-header {
  background: #33475b;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
#chatbot-header .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #0047BA;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
#chatbot-header .avatar svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}
#chatbot-header .name {
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* ---- MESSAGES AREA ---- */
#chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #fff;
  min-height: 200px;
  max-height: 340px;
}
.msg-bot {
  background: #f5f8fa;
  color: #33475b;
  padding: 12px 16px;
  border-radius: 4px 18px 18px 18px;
  font-size: 14px;
  line-height: 1.5;
  max-width: 85%;
  align-self: flex-start;
  word-wrap: break-word;
}
.msg-user {
  background: #0047BA;
  color: #fff;
  padding: 12px 16px;
  border-radius: 18px 4px 18px 18px;
  font-size: 14px;
  line-height: 1.5;
  max-width: 85%;
  align-self: flex-end;
  word-wrap: break-word;
}
.msg-options {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 4px 0 8px;
  align-self: flex-start;
  max-width: 85%;
}
.msg-options button {
  background: #fff;
  color: #33475b;
  border: 1px solid #cbd6e2;
  border-radius: 6px;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  width: 100%;
  text-align: center;
  font-family: inherit;
}
.msg-options button:hover {
  border-color: #0047BA;
  color: #0047BA;
  background: #f0f6ff;
}
.msg-options button.btn-whatsapp {
  background: #25D366;
  color: #fff;
  border-color: #25D366;
  font-weight: 600;
}
.msg-options button.btn-whatsapp:hover {
  background: #1da851;
  border-color: #1da851;
  color: #fff;
}
.msg-bot a {
  color: #0047BA;
  text-decoration: underline;
  font-weight: 500;
}
.msg-bot a:hover {
  color: #003a96;
}

/* ---- TYPING INDICATOR ---- */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: #f5f8fa;
  border-radius: 4px 18px 18px 18px;
  align-self: flex-start;
  max-width: 60px;
}
.typing-indicator span {
  width: 8px;
  height: 8px;
  background: #cbd6e2;
  border-radius: 50%;
  animation: typingBounce 1.2s infinite ease-in-out;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-6px); }
}

/* ---- INPUT BAR ---- */
#chatbot-input-bar {
  display: none;
  border-top: 1px solid #e5e7eb;
  padding: 12px 16px;
  background: #fff;
  flex-shrink: 0;
}
#chatbot-input-bar.visible {
  display: flex;
  gap: 8px;
  align-items: center;
}
#chatbot-input-bar input {
  flex: 1;
  border: 1px solid #cbd6e2;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  color: #33475b;
  outline: none;
  transition: border-color 0.15s;
}
#chatbot-input-bar input:focus {
  border-color: #0047BA;
}
#chatbot-input-bar input::placeholder {
  color: #99acc2;
}
#chatbot-input-bar button {
  width: 38px;
  height: 38px;
  border: none;
  background: #0047BA;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}
#chatbot-input-bar button:hover {
  background: #003a96;
}
#chatbot-input-bar button svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

/* ---- FOOTER ---- */
#chatbot-footer {
  text-align: center;
  padding: 8px;
  font-size: 11px;
  color: #99acc2;
  border-top: 1px solid #f0f0f0;
  background: #fff;
  flex-shrink: 0;
}
#chatbot-footer a {
  color: #0047BA;
  text-decoration: none;
  font-weight: 500;
}

/* ---- FORM STYLES ---- */
.chatbot-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 0 8px;
  align-self: flex-start;
  width: 85%;
}
.chatbot-form label {
  font-size: 12px;
  font-weight: 600;
  color: #516f90;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.chatbot-form input,
.chatbot-form textarea {
  border: 1px solid #cbd6e2;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  color: #33475b;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}
.chatbot-form input:focus,
.chatbot-form textarea:focus {
  border-color: #0047BA;
}
.chatbot-form textarea {
  resize: vertical;
  min-height: 60px;
}
.chatbot-form button {
  background: #0047BA;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 11px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
  align-self: flex-start;
}
.chatbot-form button:hover {
  background: #003a96;
}

/* ---- MOBILE ---- */
@media (max-width: 480px) {
  #chatbot-window {
    width: calc(100vw - 16px);
    right: 8px;
    bottom: 88px;
    max-height: calc(100vh - 120px);
  }
  #chatbot-launcher {
    bottom: 16px;
    right: 16px;
  }
  #chatbot-greeting {
    bottom: 84px;
    right: 16px;
    max-width: 220px;
  }
}
