/* WF Benefits Q&A widget — CWM brand colors per brand-guide.md */

:root {
  --midnight: #002939;
  --plum: #3A3B51;
  --olive: #817541;
  --gold: #BBAD78;
  --champagne: #CDBD85;
  --gray: #F5F5F5;
  --gray-dark: #E2E2E2;
  --white: #FFFFFF;
  --error: #B00020;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--gray);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--midnight);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.chat {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-height: 100dvh;
  background: var(--white);
  margin: 0 auto;
  max-width: 760px;
  border: 1px solid var(--gray-dark);
}

@media (min-width: 640px) {
  .chat {
    height: 100vh;
  }
}

/* -- Header --------------------------------------------------------------- */
.chat-header {
  background: var(--midnight);
  color: var(--white);
  padding: 16px 20px;
  border-bottom: 3px solid var(--olive);
}

.chat-header-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.chat-header-sub {
  font-size: 13px;
  opacity: 0.8;
  margin-top: 2px;
}

/* -- Messages ------------------------------------------------------------- */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--gray);
}

.message {
  display: flex;
  max-width: 100%;
}

.message-user {
  justify-content: flex-end;
}

.message-assistant {
  justify-content: flex-start;
}

.bubble {
  padding: 12px 16px;
  border-radius: 14px;
  max-width: 85%;
  font-size: 15px;
  line-height: 1.55;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.message-user .bubble {
  background: var(--midnight);
  color: var(--white);
  border-bottom-right-radius: 4px;
}

.message-assistant .bubble {
  background: var(--white);
  color: var(--midnight);
  border: 1px solid var(--gray-dark);
  border-bottom-left-radius: 4px;
}

.intro-message .bubble {
  background: transparent;
  border: 1px dashed var(--gray-dark);
  color: var(--plum);
  font-size: 14px;
}

.bubble p {
  margin: 0 0 10px 0;
}

.bubble p:last-child {
  margin-bottom: 0;
}

.bubble strong {
  font-weight: 600;
  color: var(--midnight);
}

.bubble ul, .bubble ol {
  margin: 8px 0;
  padding-left: 22px;
}

.bubble li {
  margin: 4px 0;
}

.bubble blockquote {
  margin: 10px 0;
  padding: 8px 12px;
  background: var(--gray);
  border-left: 3px solid var(--olive);
  font-style: italic;
  font-size: 14px;
  color: var(--plum);
}

.bubble hr {
  border: 0;
  border-top: 1px solid var(--gray-dark);
  margin: 12px 0;
}

.bubble a {
  color: var(--olive);
  text-decoration: underline;
}

.bubble a:hover {
  color: var(--midnight);
}

.bubble code {
  background: var(--gray);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
}

.typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 4px 0;
}

.typing span {
  width: 7px;
  height: 7px;
  background: var(--plum);
  border-radius: 50%;
  opacity: 0.4;
  animation: bounce 1.2s infinite;
}

.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%          { transform: translateY(-4px); opacity: 1; }
}

.error-message .bubble {
  background: #FDECEE;
  border-color: #F5C2C7;
  color: var(--error);
  font-size: 14px;
}

/* -- Disclaimer ----------------------------------------------------------- */
.disclaimer {
  background: var(--white);
  border-top: 1px solid var(--gray-dark);
  padding: 10px 20px;
  font-size: 12px;
  color: var(--plum);
  line-height: 1.45;
}

/* -- Composer ------------------------------------------------------------- */
.composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--white);
  border-top: 1px solid var(--gray-dark);
  padding: 12px 16px;
}

#input {
  flex: 1;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.45;
  color: var(--midnight);
  padding: 10px 14px;
  background: var(--gray);
  border: 1px solid var(--gray-dark);
  border-radius: 10px;
  resize: none;
  outline: none;
  max-height: 160px;
  overflow-y: auto;
  transition: border-color 0.15s;
}

#input:focus {
  border-color: var(--olive);
  background: var(--white);
}

#input::placeholder {
  color: var(--plum);
  opacity: 0.6;
}

#send {
  background: var(--olive);
  color: var(--white);
  border: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s;
  flex-shrink: 0;
}

#send:hover:not(:disabled) {
  background: var(--midnight);
}

#send:disabled {
  background: var(--gray-dark);
  cursor: not-allowed;
}

#send svg {
  transform: translateX(1px);
}

/* -- Mobile --------------------------------------------------------------- */
@media (max-width: 480px) {
  .chat {
    border: 0;
  }
  .messages {
    padding: 14px;
  }
  .bubble {
    max-width: 90%;
    font-size: 15px;
  }
  .chat-header {
    padding: 12px 16px;
  }
  .disclaimer {
    padding: 8px 16px;
    font-size: 11px;
  }
  .composer {
    padding: 10px 12px;
  }
}
