/* E-Tontine help chatbot widget */
.et-chat-fab {
  position: fixed;
  right: 22px;
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  z-index: 9999;
  width: 58px;
  height: 58px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(145deg, #d97706, #b45309);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 12px 32px rgba(217, 119, 6, 0.38);
  display: grid;
  place-items: center;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.et-chat-fab:hover { transform: scale(1.04); box-shadow: 0 16px 40px rgba(217, 119, 6, 0.45); }
.et-chat-fab svg { width: 26px; height: 26px; }

.et-chat-panel {
  position: fixed;
  right: 22px;
  bottom: 92px;
  z-index: 9999;
  width: min(400px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 120px));
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(15, 41, 66, 0.22);
  border: 1px solid rgba(17, 24, 39, 0.08);
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
}
.et-chat-panel.open { display: flex; }
.et-chat-panel.rtl { direction: rtl; }

.et-chat-head {
  background: #163A5C;
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}
.et-chat-head-title { font-weight: 800; font-size: 15px; letter-spacing: -0.02em; }
.et-chat-head-sub { font-size: 11px; color: #b8c6d8; margin-top: 2px; }
.et-chat-head-actions { display: flex; align-items: center; gap: 8px; }
.et-chat-lang {
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.1);
  color: #fff;
  border-radius: 8px;
  font-size: 12px;
  padding: 4px 8px;
  cursor: pointer;
}
.et-chat-close {
  border: none;
  background: rgba(255,255,255,0.12);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.et-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f6f8fb;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.et-chat-bubble {
  max-width: 88%;
  padding: 11px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}
.et-chat-bubble.bot {
  align-self: flex-start;
  background: #fff;
  color: #111827;
  border: 1px solid rgba(17,24,39,0.08);
  border-bottom-left-radius: 4px;
}
.et-chat-panel.rtl .et-chat-bubble.bot { border-bottom-left-radius: 16px; border-bottom-right-radius: 4px; }
.et-chat-bubble.user {
  align-self: flex-end;
  background: #163A5C;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.et-chat-panel.rtl .et-chat-bubble.user { border-bottom-right-radius: 16px; border-bottom-left-radius: 4px; }

.et-chat-suggestions {
  padding: 0 16px 8px;
  background: #f6f8fb;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}
.et-chat-chip {
  border: 1px solid rgba(22, 58, 92, 0.15);
  background: #fff;
  color: #163A5C;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s;
}
.et-chat-chip:hover { background: rgba(22, 58, 92, 0.06); }

.et-chat-foot {
  padding: 12px 14px;
  border-top: 1px solid rgba(17,24,39,0.08);
  background: #fff;
  flex-shrink: 0;
}
.et-chat-input-row { display: flex; gap: 8px; }
.et-chat-input {
  flex: 1;
  border: 1px solid rgba(17,24,39,0.12);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
.et-chat-input:focus { border-color: #4a6fa5; box-shadow: 0 0 0 3px rgba(74,111,165,0.15); }
.et-chat-send {
  border: none;
  background: #163A5C;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  padding: 0 16px;
  border-radius: 12px;
  cursor: pointer;
}
.et-chat-send:disabled { opacity: 0.5; cursor: not-allowed; }
.et-chat-escalate {
  margin-top: 10px;
  text-align: center;
  font-size: 12px;
}
.et-chat-escalate a { color: #d97706; font-weight: 700; text-decoration: none; }
.et-chat-escalate a:hover { text-decoration: underline; }

.et-chat-typing {
  font-size: 12px;
  color: #6b7280;
  padding: 4px 2px;
}

@media (max-width: 480px) {
  .et-chat-panel {
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    border-radius: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .et-chat-fab {
    right: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    width: 50px;
    height: 50px;
  }
  .et-chat-fab svg { width: 22px; height: 22px; }
}
