/*
  REPLACE your entire chatbot-widget.css with this file.
  
  Key change: removed reliance on HTML [hidden] attribute for panel
  visibility. Instead the panel starts with display:none by default
  in CSS, and JS adds class 'is-open' to show it. This cannot be
  overridden by any other CSS rule since the default state is
  explicitly set here, not delegated to the browser's [hidden] UA sheet.
*/

/* ===== Widget container — stacks WhatsApp + chatbot buttons ===== */
.chatbot-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 14px;
}

/* ===== WhatsApp button ===== */
.whatsapp-float {
  width: 56px; height: 56px; border-radius: 50%;
  background: #25D366;
  color: #fff; border: none; cursor: pointer; text-decoration: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
  box-shadow: 0 12px 28px -8px rgba(11,30,61,.28);
  transition: transform .15s ease, background .15s ease;
}
.whatsapp-float:hover { transform: translateY(-2px) scale(1.04); background: #20bd5a; }

/* ===== Chatbot toggle button ===== */
.chatbot-toggle {
  width: 58px; height: 58px; border-radius: 50%;
  background: linear-gradient(135deg, #0B1E3D 0%, #2563EB 55%, #38BDF8 100%);
  color: #fff; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  box-shadow: 0 12px 28px -8px rgba(11,30,61,.28);
  transition: transform .15s ease;
}
.chatbot-toggle:hover { transform: translateY(-2px) scale(1.04); }

/* ===== Chat panel — HIDDEN BY DEFAULT via display:none ===== */
.chatbot-panel {
  /* Hidden by default — JS adds .is-open to show */
  display: none;
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 340px;
  max-width: calc(100vw - 32px);
  height: 460px;
  max-height: 70vh;
  background: #fff;
  border-radius: 16px;
  border: 1px solid #E2E9F5;
  box-shadow: 0 24px 60px -12px rgba(11,30,61,.28);
  flex-direction: column;
  overflow: hidden;
  z-index: 1300;
}

/* Show panel when JS adds .is-open */
.chatbot-panel.is-open {
  display: flex;
}

/* ===== Header bar ===== */
.chatbot-header {
  background: linear-gradient(135deg, #0B1E3D 0%, #2563EB 55%, #38BDF8 100%);
  color: #fff;
  padding: 16px 18px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.chatbot-header strong { display: block; font-size: .95rem; font-family: 'Space Grotesk', sans-serif; }
.chatbot-header span { font-size: .76rem; color: rgba(255,255,255,.75); }
.chatbot-close {
  background: rgba(255,255,255,.12); border: none; color: #fff;
  width: 30px; height: 30px; border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.chatbot-close:hover { background: rgba(255,255,255,.25); }

/* ===== Messages area ===== */
.chatbot-messages {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
  background: #F1F5FB;
}

/* ===== Message bubbles ===== */
.chatbot-msg {
  max-width: 85%; padding: 10px 13px; border-radius: 12px;
  font-size: .87rem; line-height: 1.45; word-wrap: break-word;
}
.chatbot-msg--bot {
  background: #fff; color: #33415C;
  border: 1px solid #E2E9F5;
  align-self: flex-start; border-bottom-left-radius: 4px;
}
.chatbot-msg--user {
  background: #2563EB; color: #fff;
  align-self: flex-end; border-bottom-right-radius: 4px;
}
.chatbot-msg-link {
  display: inline-block; margin-top: 6px; font-weight: 600;
  color: #2563EB; text-decoration: underline;
}

/* ===== Typing indicator ===== */
.chatbot-msg--typing {
  display: flex; gap: 4px;
  padding: 14px 16px; align-self: flex-start;
  background: #fff; border: 1px solid #E2E9F5;
  border-radius: 12px; border-bottom-left-radius: 4px;
}
.chatbot-msg--typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: #5B6B85; opacity: .5;
  animation: chatbot-bounce 1.2s infinite ease-in-out;
}
.chatbot-msg--typing span:nth-child(2) { animation-delay: .15s; }
.chatbot-msg--typing span:nth-child(3) { animation-delay: .3s; }
@keyframes chatbot-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: .4; }
  40% { transform: translateY(-4px); opacity: 1; }
}

/* ===== Input form ===== */
.chatbot-form {
  display: flex; gap: 8px; padding: 12px;
  border-top: 1px solid #E2E9F5;
  background: #fff;
  flex-shrink: 0;
}
.chatbot-form input {
  flex: 1; padding: 10px 12px;
  border: 1px solid #E2E9F5; border-radius: 9px;
  font-family: inherit; font-size: .87rem; outline: none;
}
.chatbot-form input:focus { border-color: #2563EB; }
.chatbot-form button {
  width: 40px; height: 40px; border-radius: 9px; border: none;
  background: #2563EB; color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background .15s ease;
}
.chatbot-form button:hover { background: #1d4ed8; }

/* ===== Mobile ===== */
@media (max-width: 480px) {
  .chatbot-widget { bottom: 16px; right: 16px; gap: 10px; }
  .chatbot-toggle { width: 50px; height: 50px; font-size: 1.2rem; }
  .whatsapp-float { width: 50px; height: 50px; font-size: 1.35rem; }

  /* On mobile, panel slides up from bottom full-width */
  .chatbot-panel {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    width: 100%;
    max-width: 100%;
    height: 70vh;
    border-radius: 20px 20px 0 0;
  }
}
