/* ============================================================
   NOTCHAI CHATBOT WIDGET — chatbot.css
   ============================================================ */

.notchai-chat {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
  font-family: var(--font-sans, 'Outfit', sans-serif);
}

/* Toggle button */
#notchai-chat-toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-accent, #166616);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(22,102,22,.45);
  transition: transform .2s ease, background .2s ease, box-shadow .2s ease;
  position: relative;
  z-index: 2;
}
#notchai-chat-toggle:hover {
  background: var(--color-accent-light, #1f8c1f);
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(22,102,22,.6);
}
#notchai-chat-toggle svg { width: 24px; height: 24px; }

/* Pulse ring */
#notchai-chat-toggle::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--color-accent, #166616);
  animation: chat-pulse 2.5s ease-out infinite;
  pointer-events: none;
}
@keyframes chat-pulse {
  0%   { opacity: .6; transform: scale(1); }
  70%  { opacity: 0;  transform: scale(1.35); }
  100% { opacity: 0;  transform: scale(1.35); }
}

/* Nudge tooltip */
.notchai-chat-nudge {
  position: absolute;
  bottom: calc(100% + .75rem);
  right: 0;
  background: var(--color-surface, #111);
  border: 1px solid var(--color-border, #222);
  border-radius: .75rem;
  padding: .6rem 1rem;
  font-size: .82rem;
  color: var(--color-text, #f0f0f0);
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
  animation: nudge-in .4s ease;
  cursor: pointer;
}
.notchai-chat-nudge::after {
  content: '';
  position: absolute;
  bottom: -.4rem;
  right: 1.5rem;
  width: .7rem; height: .7rem;
  background: var(--color-surface, #111);
  border-right: 1px solid var(--color-border, #222);
  border-bottom: 1px solid var(--color-border, #222);
  transform: rotate(45deg);
}
.notchai-chat-nudge.hidden { display: none; }
@keyframes nudge-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Chat window */
#notchai-chat-window {
  display: none;
  position: absolute;
  bottom: calc(100% + .75rem);
  right: 0;
  width: 360px;
  max-height: 520px;
  background: var(--color-surface, #111);
  border: 1px solid var(--color-border, #222);
  border-radius: 1.25rem;
  box-shadow: 0 16px 48px rgba(0,0,0,.6);
  flex-direction: column;
  overflow: hidden;
  animation: window-in .25s ease;
}
#notchai-chat-window.open {
  display: flex;
}
@keyframes window-in {
  from { opacity: 0; transform: translateY(12px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Header */
#notchai-chat-header {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .9rem 1rem;
  border-bottom: 1px solid var(--color-border, #222);
  background: var(--color-surface-2, #161616);
  flex-shrink: 0;
}
#notchai-chat-header::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--color-accent, #166616);
  box-shadow: 0 0 6px var(--color-accent, #166616);
  flex-shrink: 0;
}
#notchai-chat-title {
  font-size: .9rem;
  font-weight: 700;
  color: var(--color-text, #f0f0f0);
}
#notchai-chat-header span {
  font-size: .8rem;
  color: var(--color-text-muted, #888);
  flex: 1;
}
#notchai-chat-close {
  width: 28px; height: 28px;
  border-radius: 50%;
  font-size: 1.1rem;
  color: var(--color-text-muted, #888);
  display: flex; align-items: center; justify-content: center;
  transition: background .15s ease, color .15s ease;
}
#notchai-chat-close:hover {
  background: rgba(255,255,255,.08);
  color: var(--color-text, #f0f0f0);
}

/* Messages area */
#notchai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  scroll-behavior: smooth;
}
#notchai-chat-messages::-webkit-scrollbar { width: 4px; }
#notchai-chat-messages::-webkit-scrollbar-track { background: transparent; }
#notchai-chat-messages::-webkit-scrollbar-thumb { background: var(--color-border, #222); border-radius: 2px; }

.chat-msg {
  max-width: 85%;
  padding: .65rem .9rem;
  border-radius: .9rem;
  font-size: .88rem;
  line-height: 1.55;
  animation: msg-in .2s ease;
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.chat-msg.user {
  background: var(--color-accent, #166616);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: .25rem;
}
.chat-msg.bot {
  background: var(--color-surface-2, #161616);
  border: 1px solid var(--color-border, #222);
  color: var(--color-text, #f0f0f0);
  align-self: flex-start;
  border-bottom-left-radius: .25rem;
}
.chat-msg.error {
  background: rgba(180,30,30,.15);
  border: 1px solid rgba(180,30,30,.3);
  color: #f87171;
  align-self: flex-start;
  font-size: .82rem;
}

/* Typing indicator */
.chat-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: .65rem .9rem;
  background: var(--color-surface-2, #161616);
  border: 1px solid var(--color-border, #222);
  border-radius: .9rem;
  border-bottom-left-radius: .25rem;
  align-self: flex-start;
  width: fit-content;
}
.chat-typing span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--color-text-muted, #888);
  animation: typing-dot 1.2s ease infinite;
}
.chat-typing span:nth-child(2) { animation-delay: .2s; }
.chat-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes typing-dot {
  0%, 80%, 100% { transform: scale(.8); opacity: .4; }
  40%            { transform: scale(1.1); opacity: 1; }
}

/* Input form */
#notchai-chat-form {
  display: flex;
  align-items: flex-end;
  gap: .5rem;
  padding: .75rem;
  border-top: 1px solid var(--color-border, #222);
  background: var(--color-surface-2, #161616);
  flex-shrink: 0;
}
#notchai-chat-input {
  flex: 1;
  background: var(--color-bg, #0d0d0d);
  border: 1px solid var(--color-border, #222);
  border-radius: .75rem;
  color: var(--color-text, #f0f0f0);
  font-family: inherit;
  font-size: .88rem;
  padding: .6rem .9rem;
  resize: none;
  max-height: 100px;
  line-height: 1.5;
  outline: none;
  transition: border-color .15s ease;
}
#notchai-chat-input:focus { border-color: var(--color-accent, #166616); }
#notchai-chat-input::placeholder { color: var(--color-text-muted, #888); }
#notchai-chat-send {
  width: 38px; height: 38px;
  border-radius: .75rem;
  background: var(--color-accent, #166616);
  color: #fff;
  font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background .15s ease, transform .15s ease;
}
#notchai-chat-send:hover {
  background: var(--color-accent-light, #1f8c1f);
  transform: scale(1.05);
}
#notchai-chat-send:disabled {
  opacity: .4;
  cursor: not-allowed;
  transform: none;
}

@media (max-width: 420px) {
  .notchai-chat { bottom: 1rem; right: 1rem; }
  #notchai-chat-window { width: calc(100vw - 2rem); right: -1rem; }
}
