/* ChatBot widget styles - polished and modern */
#chatbot-root {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 2000;
  font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
}

#chatbot-toggle {
  background: linear-gradient(135deg, #5db5ff 0%, #2d77d1 100%);
  color: #ffffff;
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  box-shadow: 0 12px 30px rgba(13, 40, 70, 0.35);
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Chat button spacing tweaks */
@media (max-width:420px){
  #chatbot-toggle{padding:10px 14px}
}

#chatbot-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(13, 40, 70, 0.42);
}

#chatbot-window {
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 500px;
  background: linear-gradient(180deg, rgba(7, 16, 30, 0.98) 0%, rgba(14, 29, 49, 0.98) 100%);
  border: 1px solid rgba(93, 181, 255, 0.16);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(2, 12, 30, 0.55);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-top: 12px;
  backdrop-filter: blur(10px);
}

#chatbot-window.hidden {
  display: none;
}

.chatbot-header {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 14px 16px;
  background: linear-gradient(90deg, rgba(93, 181, 255, 0.16), rgba(45, 119, 209, 0.12));
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #eaf6ff;
  font-weight: 700;
}

.chatbot-title {
  text-align: center;
  letter-spacing: 0.02em;
}

#chatbot-close {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  color: #ffffff;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  opacity: 0.9;
}

/* Avatar image in chat header */
#chatbot-avatar {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.06);
}

#chatbot-messages {
  padding: 14px;
  flex: 1 1 auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: radial-gradient(circle at top left, rgba(93, 181, 255, 0.07), transparent 35%);
  align-items: stretch;
}

/* Message layout with avatar and bubble */
.msg{
  width: 100%;
  display:flex;
  align-items:flex-start;
  gap:10px;
}

.msg.bot{
  justify-content:flex-start;
}

.msg.bot::before{
  content: '';
  width:36px;
  height:36px;
  flex:0 0 36px;
  border-radius:8px;
  background-image: url('RÊ.jpeg');
  background-size: cover;
  background-position:center;
}

.msg.user{
  justify-content:flex-end;
}

.msg.user .bubble{
  margin-left:auto;
}

.msg .bubble{
  display:inline-block;
  padding:12px 16px;
  border-radius:18px;
  max-width:72%;
  line-height:1.4;
  box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.msg.bot .bubble{
  background: rgba(255, 255, 255, 0.12);
  color:#eaf6ff;
  border: 1px solid rgba(255,255,255,0.12);
  border-bottom-left-radius:6px;
}

.msg.user .bubble{
  background: linear-gradient(135deg, #5db5ff 0%, #2d77d1 100%);
  color:#fff;
  border-bottom-right-radius:6px;
}

.message-time{
  display:block;
  font-size:0.72rem;
  color:rgba(0,0,0,0.45);
  text-align:center;
  margin:6px 0 0;
}

.chatbot-form{
  display:flex;
  gap:8px;
  padding:12px;
  border-top:1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
}

#chatbot-input{
  flex:1;
  padding:12px 16px;
  border-radius:28px;
  border:1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.06);
  color:#eaf6ff;
  outline:none;
}

#chatbot-input::placeholder{ color: rgba(234,246,255,0.65); }

.chatbot-form button{
  padding:10px 14px;
  border-radius:20px;
  border:none;
  background: linear-gradient(135deg, #5db5ff 0%, #2d77d1 100%);
  color:#fff;
  font-weight:700;
}

.typing {
  font-style: italic;
  opacity: 0.9;
}

@media (max-width: 640px) {
  #chatbot-root {
    right: 10px;
    bottom: 10px;
  }

  #chatbot-window {
    width: min(100vw - 20px, 360px);
    height: min(74vh, 500px);
    border-radius: 16px;
  }
}

@media (max-width: 420px) {
  #chatbot-toggle {
    padding: 10px 14px;
  }

  #chatbot-window {
    width: min(100vw - 16px, 360px);
    height: 70vh;
    border-radius: 16px;
  }
}
