/* RAHA Financials assistant widget. Scoped under .raha-chat so it cannot
   collide with the site's existing styles. */

.raha-launcher-wrap {
  position: fixed; right: 20px; bottom: 20px; z-index: 9998;
  width: 56px; height: 56px;
}
.raha-launcher-wrap[hidden] { display: none; }

.raha-chat-launcher {
  width: 56px; height: 56px; border-radius: 50%;
  background: #1a3a5c; color: #fff; border: none; cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s ease, background .15s ease;
}
.raha-chat-launcher:hover { transform: scale(1.06); background: #24507d; }
.raha-chat-launcher svg { width: 26px; height: 26px; fill: currentColor; }

/* Dismiss (x) badge on the launcher's corner -- hidden until the launcher
   area is hovered, same reveal pattern as the greeting card's own dismiss. */
.raha-launcher-dismiss {
  position: absolute; top: -6px; right: -6px; width: 22px; height: 22px;
  border-radius: 50%; border: 2px solid #fff; background: #5a6b7a; color: #fff;
  font-size: 14px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .15s ease, background .15s ease;
}
.raha-launcher-wrap:hover .raha-launcher-dismiss,
.raha-launcher-dismiss:focus-visible { opacity: 1; }
.raha-launcher-dismiss:hover { background: #b0362a; }

.raha-chat-panel {
  position: fixed; right: 20px; bottom: 20px; z-index: 9999;
  width: 380px; max-width: calc(100vw - 32px);
  height: 560px; max-height: calc(100vh - 40px);
  background: #fff; border-radius: 14px; overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,.28);
  display: flex; flex-direction: column;
  font-family: 'Inter', system-ui, -apple-system, "Segoe UI", sans-serif;
}
.raha-chat-panel[hidden] { display: none; }

.raha-chat-header {
  background: #1a3a5c; color: #fff; padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.raha-chat-header h3 { margin: 0; font-size: 15px; font-weight: 600; }
.raha-chat-header p  { margin: 2px 0 0; font-size: 12px; opacity: .8; }
.raha-chat-close {
  background: none; border: none; color: #fff; cursor: pointer;
  font-size: 22px; line-height: 1; padding: 0 4px; opacity: .85;
}
.raha-chat-close:hover { opacity: 1; }

.raha-chat-log {
  flex: 1; overflow-y: auto; padding: 16px;
  background: #f7f9fb; display: flex; flex-direction: column; gap: 10px;
}
.raha-msg { max-width: 85%; padding: 10px 13px; border-radius: 12px;
  font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.raha-msg-bot  { background: #fff; color: #1c2b3a; align-self: flex-start;
  border: 1px solid #e3e9ef; border-bottom-left-radius: 4px; }
.raha-msg-user { background: #1a3a5c; color: #fff; align-self: flex-end;
  border-bottom-right-radius: 4px; }
.raha-msg-error { background: #fdecea; color: #8a2f26; border: 1px solid #f5c6c2; align-self: flex-start; }

.raha-typing { display: flex; gap: 4px; padding: 12px 14px; align-self: flex-start;
  background: #fff; border: 1px solid #e3e9ef; border-radius: 12px; }
.raha-typing span { width: 7px; height: 7px; border-radius: 50%; background: #9bb0c4;
  animation: raha-bounce 1.2s infinite ease-in-out; }
.raha-typing span:nth-child(2) { animation-delay: .15s; }
.raha-typing span:nth-child(3) { animation-delay: .30s; }
@keyframes raha-bounce { 0%,60%,100% { transform: translateY(0); opacity: .5; }
                         30% { transform: translateY(-5px); opacity: 1; } }

.raha-chat-escalate { align-self: flex-start; display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.raha-chat-escalate a {
  font-size: 13px; text-decoration: none; padding: 8px 12px; border-radius: 8px;
  background: #1a3a5c; color: #fff; font-weight: 500;
}
.raha-chat-escalate a.secondary { background: #fff; color: #1a3a5c; border: 1px solid #c3d2e0; }

.raha-chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid #e3e9ef; background: #fff; }
.raha-chat-form input {
  flex: 1; padding: 10px 12px; border: 1px solid #cfd9e3; border-radius: 8px;
  font-size: 14px; font-family: inherit; outline: none;
}
.raha-chat-form input:focus { border-color: #1a3a5c; }
.raha-chat-form button {
  background: #1a3a5c; color: #fff; border: none; border-radius: 8px;
  padding: 0 16px; cursor: pointer; font-size: 14px; font-weight: 500;
}
.raha-chat-form button:disabled { opacity: .5; cursor: default; }

.raha-chat-note { font-size: 11px; color: #7d8b99; text-align: center; padding: 0 12px 10px; background: #fff; }

@media (max-width: 480px) {
  .raha-chat-panel { right: 0; bottom: 0; width: 100vw; max-width: 100vw;
    height: 100dvh; max-height: 100dvh; border-radius: 0; }
}

/* Proactive greeting bubble shown on arrival, above the launcher icon. */
.raha-greet {
  position: fixed; right: 20px; bottom: 88px; z-index: 9997;
  width: 300px; max-width: calc(100vw - 40px);
  background: #fff; border-radius: 14px 14px 4px 14px;
  box-shadow: 0 10px 32px rgba(0,0,0,.22);
  padding: 16px 18px; font-family: 'Inter', system-ui, -apple-system, "Segoe UI", sans-serif;
  animation: raha-greet-in .25s ease-out;
}
.raha-greet[hidden] { display: none; }
@keyframes raha-greet-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.raha-greet-close {
  position: absolute; top: 8px; right: 8px; width: 24px; height: 24px;
  border-radius: 50%; border: none; background: #eef2f6; color: #5a6b7a;
  font-size: 15px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .15s ease, background .15s ease;
}
.raha-greet:hover .raha-greet-close,
.raha-greet-close:focus-visible { opacity: 1; }
.raha-greet-close:hover { background: #dfe6ed; }

.raha-greet-text {
  margin: 0 18px 12px 0; font-size: 14px; line-height: 1.5; color: #1c2b3a;
}

.raha-greet-options { display: flex; flex-direction: column; gap: 8px; }
.raha-greet-option {
  text-align: left; background: #fff; border: 1.5px solid #1a3a5c; color: #1a3a5c;
  border-radius: 8px; padding: 9px 12px; font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: background .15s ease, color .15s ease;
}
.raha-greet-option:hover { background: #1a3a5c; color: #fff; }

@media (max-width: 480px) {
  .raha-greet { right: 16px; bottom: 88px; width: calc(100vw - 32px); }
}

/* Email gate: shown in place of the log+form until an email is captured. */
.raha-chat-gate {
  flex: 1; display: flex; flex-direction: column; justify-content: center;
  gap: 14px; padding: 24px 20px; background: #f7f9fb;
}
.raha-chat-gate[hidden] { display: none; }
.raha-chat-gate-text { margin: 0; font-size: 14px; line-height: 1.5; color: #1c2b3a; }
.raha-chat-gate-form { display: flex; gap: 8px; }
.raha-chat-gate-form input {
  flex: 1; padding: 10px 12px; border: 1px solid #cfd9e3; border-radius: 8px;
  font-size: 14px; font-family: inherit; outline: none;
}
.raha-chat-gate-form input:focus { border-color: #1a3a5c; }
.raha-chat-gate-form button {
  background: #1a3a5c; color: #fff; border: none; border-radius: 8px;
  padding: 0 16px; cursor: pointer; font-size: 14px; font-weight: 500; white-space: nowrap;
}
.raha-chat-gate-form button:disabled { opacity: .5; cursor: default; }
.raha-chat-gate-error { margin: 0; font-size: 12.5px; color: #b0362a; min-height: 1em; }
