/* assets/css/chat-widget.css */
:root {
  --chat-primary: #0f3b84;
  --chat-secondary: #2b74d0;
  --chat-bg: #ffffff;
  --chat-text: #122b54;
  --chat-muted: #5a7198;
  --chat-shadow: 0 16px 40px rgba(14, 44, 90, 0.2);
  --chat-font: 'Montserrat', sans-serif;
}

.chat-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 9999;
  border: 1px solid #b5cff2;
  background: linear-gradient(150deg, #ffffff, #f0f7ff 62%, #e8f2ff);
  color: var(--chat-text);
  box-shadow: 0 16px 34px rgba(15, 45, 92, 0.22);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px 10px 10px;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}

.chat-fab:hover {
  transform: translateY(-2px) scale(1.01);
  border-color: #92b9ec;
  box-shadow: 0 20px 38px rgba(15, 45, 92, 0.25);
}

.chat-fab-orb {
  width: 50px;
  height: 50px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(140deg, #2f8cff, #1f61b8 55%, #174f97);
  box-shadow: 0 8px 18px rgba(13, 57, 120, 0.38), inset 0 1px 3px rgba(255, 255, 255, 0.28);
  position: relative;
}

.chat-fab-orb::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: inherit;
  border: 1px solid rgba(47, 132, 245, 0.32);
  animation: astraPulse 2.2s ease-out infinite;
}

.astra-mark {
  width: 30px;
  height: 30px;
}

.astra-mark path {
  fill: #ffffff;
}

.astra-mark path:nth-child(2) {
  fill: none;
  stroke: #ffffff;
  stroke-width: 3.4;
  stroke-linecap: round;
}

.astra-mark path:nth-child(3) {
  fill: rgba(255, 255, 255, 0.96);
}

.chat-fab-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.chat-fab-meta strong {
  font-size: 14px;
  letter-spacing: 0.06em;
  color: #103868;
}

.chat-fab-meta small {
  font-size: 11px;
  color: #5073a4;
  font-weight: 600;
}

@keyframes astraPulse {
  0% { transform: scale(1); opacity: .7; }
  100% { transform: scale(1.28); opacity: 0; }
}

.chat-window {
  position: fixed;
  right: 18px;
  bottom: 92px;
  width: min(360px, calc(100vw - 24px));
  height: min(560px, calc(100vh - 110px));
  background: var(--chat-bg);
  border-radius: 18px;
  box-shadow: var(--chat-shadow);
  border: 1px solid #d8e5f8;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  transform-origin: bottom right;
  transform: translateY(10px) scale(.95);
  opacity: 0;
  pointer-events: none;
  transition: all .26s ease;
  font-family: var(--chat-font);
}

.chat-window.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.chat-header {
  background: linear-gradient(130deg, var(--chat-primary), #2459a7);
  color: #fff;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.45);
}

.chat-avatar-logo {
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.16);
}

.chat-avatar-logo .astra-mark {
  width: 22px;
  height: 22px;
}

.chat-title h4 {
  margin: 0;
  font-size: 15px;
  line-height: 1;
}

.chat-title span {
  font-size: 11px;
  opacity: 0.9;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3ed17a;
}

.chat-close {
  border: 0;
  background: transparent;
  color: #fff;
  opacity: .9;
  font-size: 18px;
}

.chat-messages {
  flex: 1;
  padding: 14px;
  overflow-y: auto;
  background: linear-gradient(180deg, #f8fbff, #f3f7ff);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  max-width: 82%;
  padding: 10px 13px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
}

.message.bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid #d9e6f8;
  color: #1d3968;
}

.message.user {
  align-self: flex-end;
  background: var(--chat-primary);
  color: #fff;
}

.typing-indicator {
  display: inline-flex;
  gap: 4px;
  align-self: flex-start;
  background: #fff;
  border: 1px solid #d9e6f8;
  border-radius: 999px;
  padding: 8px 10px;
}

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #8ea4c9;
  animation: typing 1.2s infinite ease-in-out;
}

.typing-dot:nth-child(2) { animation-delay: .15s; }
.typing-dot:nth-child(3) { animation-delay: .3s; }

@keyframes typing {
  0%, 80%, 100% { transform: scale(.65); opacity: .45; }
  40% { transform: scale(1); opacity: 1; }
}

.chat-input-area {
  padding: 11px;
  border-top: 1px solid #e2ebfa;
  background: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-input {
  flex: 1;
  border: 1px solid #d5e2f6;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 13px;
  color: #14315f;
  outline: none;
  font-family: inherit;
}

.chat-input:focus {
  border-color: #acc5ea;
  box-shadow: 0 0 0 3px rgba(23, 73, 147, 0.1);
}

.chat-send-btn {
  border: 0;
  border-radius: 10px;
  background: var(--chat-primary);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  padding: 9px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chat-send-btn:hover {
  background: #143f86;
}

@media (max-width: 480px) {
  .chat-fab {
    right: 12px;
    bottom: 12px;
    padding: 8px;
  }

  .chat-fab-meta {
    display: none;
  }

  .chat-fab-orb {
    width: 46px;
    height: 46px;
  }

  .chat-window {
    right: 12px;
    left: 12px;
    width: auto;
    height: min(76vh, 560px);
    bottom: 70px;
  }
}
