/* ===========================================================================
   Sachin Sirohi portfolio assistant - chat widget
   Uses the site theme tokens from style.css (--bg, --accent, etc.)
   =========================================================================== */

.ss-chat,
.ss-chat * {
  box-sizing: border-box;
}

/* Launcher button -------------------------------------------------------- */
.ss-chat-launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1000;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.2rem 0.85rem 1rem;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #03120b;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(85, 230, 165, 0.28), 0 4px 12px rgba(0, 0, 0, 0.4);
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.2s ease;
}

.ss-chat-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(85, 230, 165, 0.36), 0 6px 16px rgba(0, 0, 0, 0.45);
}

.ss-chat-launcher svg { width: 22px; height: 22px; flex-shrink: 0; }

.ss-chat-launcher .ss-launcher-dot {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 10px;
  height: 10px;
  background: #ff5d5d;
  border-radius: 50%;
  border: 2px solid var(--accent);
}

.ss-chat.is-open .ss-chat-launcher { opacity: 0; pointer-events: none; }

/* Panel ------------------------------------------------------------------ */
.ss-chat-panel {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1001;
  width: min(380px, calc(100vw - 32px));
  height: min(620px, calc(100vh - 40px));
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  font-family: var(--font);
  opacity: 0;
  transform: translateY(16px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

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

/* Header */
.ss-chat-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.95rem 1rem;
  background: linear-gradient(135deg, rgba(85, 230, 165, 0.16), rgba(85, 230, 165, 0.04));
  border-bottom: 1px solid var(--border);
}

.ss-chat-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
  flex-shrink: 0;
}

.ss-chat-id { line-height: 1.3; min-width: 0; }
.ss-chat-id strong { display: block; color: var(--text); font-size: 0.95rem; font-weight: 600; }
.ss-chat-id span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-muted);
  font-size: 0.78rem;
}
.ss-chat-id span::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(85, 230, 165, 0.2);
}

.ss-chat-close {
  margin-left: auto;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.3rem;
  line-height: 1;
  transition: background 0.15s ease, color 0.15s ease;
}
.ss-chat-close:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }

/* Message list */
.ss-chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}
.ss-chat-log::-webkit-scrollbar { width: 7px; }
.ss-chat-log::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.16); border-radius: 4px; }

.ss-msg {
  max-width: 85%;
  padding: 0.7rem 0.9rem;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
  animation: ss-msg-in 0.22s ease;
}
@keyframes ss-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ss-msg-bot {
  align-self: flex-start;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.ss-msg-user {
  align-self: flex-end;
  background: var(--accent);
  color: #03120b;
  font-weight: 500;
  border-bottom-right-radius: 4px;
}

.ss-msg a { color: inherit; font-weight: 600; text-decoration: underline; }
.ss-msg-bot a { color: var(--accent); }

/* Typing indicator */
.ss-typing { display: inline-flex; gap: 4px; align-items: center; }
.ss-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: ss-bounce 1.2s infinite ease-in-out;
}
.ss-typing span:nth-child(2) { animation-delay: 0.18s; }
.ss-typing span:nth-child(3) { animation-delay: 0.36s; }
@keyframes ss-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* Quick reply chips */
.ss-chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0 1rem 0.6rem;
}
.ss-chip {
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.8rem;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.ss-chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* CTA card shown when the limit is reached */
.ss-chat-cta {
  margin: 0.2rem 0;
  padding: 0.9rem 1rem;
  background: var(--accent-soft);
  border: 1px solid rgba(85, 230, 165, 0.3);
  border-radius: 14px;
  align-self: stretch;
  text-align: center;
}
.ss-chat-cta p { color: var(--text); font-size: 0.88rem; margin: 0 0 0.7rem; line-height: 1.5; }
.ss-chat-cta a {
  display: inline-block;
  padding: 0.6rem 1.1rem;
  background: var(--accent);
  color: #03120b;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 999px;
  text-decoration: none;
}

/* Composer */
.ss-chat-form {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.7rem;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}
.ss-chat-input {
  flex: 1;
  resize: none;
  max-height: 96px;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-soft);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  line-height: 1.4;
  outline: none;
  transition: border-color 0.15s ease;
}
.ss-chat-input:focus { border-color: var(--accent); }
.ss-chat-input::placeholder { color: var(--text-muted); }
.ss-chat-input:disabled { opacity: 0.5; cursor: not-allowed; }

.ss-chat-send {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #03120b;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.ss-chat-send:hover { transform: translateY(-1px); }
.ss-chat-send:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.ss-chat-send svg { width: 19px; height: 19px; }

.ss-chat-foot {
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-muted);
  padding: 0 0.7rem 0.6rem;
}
.ss-chat-foot b { color: var(--text); font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  .ss-chat-launcher,
  .ss-chat-panel,
  .ss-msg,
  .ss-typing span { transition: none; animation: none; }
}
