/* Adra chat widget — self-contained, scoped to .adra-cw */
.adra-cw, .adra-cw * { box-sizing: border-box; }

.adra-cw {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2147483000;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #0A0A12;
}

/* Launcher (closed state) */
.adra-cw-launcher {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #FFFFFF;
  color: #0A0A12;
  border: 1px solid #E8E6E1;
  border-radius: 999px;
  padding: 8px 20px 8px 8px;
  cursor: pointer;
  box-shadow: 0 12px 40px rgba(10, 10, 18, 0.18);
  transition: transform 180ms ease, box-shadow 180ms ease;
  font: inherit;
}
.adra-cw-launcher:hover { transform: translateY(-2px); box-shadow: 0 18px 48px rgba(10,10,18,0.22); }
.adra-cw-launcher-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background-image: var(--adra-cw-avatar-url); background-size: cover; background-position: center;
  flex: 0 0 44px;
}
.adra-cw-launcher-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.adra-cw-launcher-name { font-weight: 600; font-size: 14px; }
.adra-cw-launcher-role { font-size: 12px; color: #5B5E69; }
.adra-cw-launcher-status {
  width: 8px; height: 8px; border-radius: 50%;
  background: #3DD68C;
  position: absolute; right: 12px; top: 12px;
  box-shadow: 0 0 0 2px #FFFFFF;
}

/* Chat panel */
.adra-cw-panel {
  width: 380px;
  height: 560px;
  max-height: calc(100vh - 40px);
  background: #FFFFFF;
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(10, 10, 18, 0.24);
  display: none;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #E8E6E1;
}
.adra-cw.open .adra-cw-panel { display: flex; }
.adra-cw.open .adra-cw-launcher { display: none; }

.adra-cw-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 16px 16px 18px;
  border-bottom: 1px solid #F1F0EC;
}
.adra-cw-header-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background-image: var(--adra-cw-avatar-url); background-size: cover; background-position: center;
  flex: 0 0 40px;
  position: relative;
}
.adra-cw-header-avatar::after {
  content: ''; position: absolute; right: -2px; bottom: -2px;
  width: 10px; height: 10px; border-radius: 50%; background: #3DD68C;
  box-shadow: 0 0 0 2px #FFFFFF;
}
.adra-cw-header-title { flex: 1; line-height: 1.2; }
.adra-cw-header-name { font-weight: 600; font-size: 15px; color: #0A0A12; }
.adra-cw-header-role { font-size: 12px; color: #5B5E69; }
.adra-cw-close {
  background: transparent; border: none; cursor: pointer;
  color: #5B5E69; padding: 6px; border-radius: 8px;
  font: inherit; line-height: 0;
}
.adra-cw-close:hover { background: #F6F5F2; color: #0A0A12; }
.adra-cw-close svg { width: 20px; height: 20px; }

.adra-cw-log {
  flex: 1;
  overflow-y: auto;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #FBFAF7;
}
.adra-cw-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.adra-cw-msg-bot {
  align-self: flex-start;
  background: #FFFFFF;
  border: 1px solid #E8E6E1;
  color: #0A0A12;
  border-bottom-left-radius: 4px;
}
.adra-cw-msg-user {
  align-self: flex-end;
  background: #0A0A12;
  color: #FFFFFF;
  border-bottom-right-radius: 4px;
}
.adra-cw-msg a { color: #9F80DA; text-decoration: underline; }
.adra-cw-msg-user a { color: #C9B8F0; }

.adra-cw-typing {
  align-self: flex-start;
  display: inline-flex; gap: 4px;
  padding: 12px 14px;
  background: #FFFFFF;
  border: 1px solid #E8E6E1;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
}
.adra-cw-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: #9699A3;
  animation: adra-cw-bounce 1.2s infinite ease-in-out;
}
.adra-cw-typing span:nth-child(2) { animation-delay: 0.15s; }
.adra-cw-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes adra-cw-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.adra-cw-cta {
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  background: #9F80DA;
  color: #FFFFFF;
  border-radius: 999px;
  font-weight: 500; font-size: 14px;
  text-decoration: none;
  transition: transform 120ms ease, background 120ms ease;
}
.adra-cw-cta:hover { background: #8A6BC7; transform: translateY(-1px); }

.adra-cw-form {
  display: flex; gap: 8px;
  padding: 12px 12px 14px;
  border-top: 1px solid #F1F0EC;
  background: #FFFFFF;
}
.adra-cw-input {
  flex: 1;
  border: 1px solid #E8E6E1;
  background: #FBFAF7;
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  resize: none;
  outline: none;
  max-height: 100px;
  min-height: 40px;
  color: #0A0A12;
}
.adra-cw-input:focus { border-color: #9F80DA; background: #FFFFFF; }
.adra-cw-send {
  flex: 0 0 40px;
  width: 40px; height: 40px;
  border: none; border-radius: 12px;
  background: #0A0A12; color: #FFFFFF;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.adra-cw-send:disabled { opacity: 0.4; cursor: not-allowed; }
.adra-cw-send:hover:not(:disabled) { background: #1B1D24; }
.adra-cw-send svg { width: 18px; height: 18px; }

.adra-cw-footer {
  padding: 8px 16px 12px;
  font-size: 11px;
  color: #9699A3;
  text-align: center;
  background: #FFFFFF;
  border-top: 1px solid #F1F0EC;
}

/* Mobile */
@media (max-width: 480px) {
  .adra-cw { right: 12px; bottom: 12px; }
  .adra-cw-panel {
    width: calc(100vw - 24px);
    height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    border-radius: 20px;
  }
  .adra-cw-launcher-text { display: none; }
  .adra-cw-launcher { padding: 4px; }
}
