/* ============================================
   Floating Chatbot Widget — Any's Portfolio
   Fixed bottom-right corner, bank-style.
   Dark theme to match Massively by HTML5 UP.
   ============================================ */

/* ── Outer widget container ── */
#chatbot-widget {
  position: fixed;
  bottom: 1.8rem;
  right: 1.8rem;
  z-index: 9000;
  font-family: 'Source Sans Pro', 'Helvetica Neue', Arial, sans-serif;
}

/* ── Toggle button ── */
#chatbot-toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #d35400;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.25rem;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  outline: none;
  margin-left: auto;
}

#chatbot-toggle:hover {
  background: #e67e22;
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.55);
}

/* ── Chat panel ── */
#chatbot-panel {
  position: absolute;
  bottom: 68px;
  right: 0;
  width: 322px;
  display: flex;
  flex-direction: column;
  background: #1c1c1c;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.65);
  overflow: visible;
  transform-origin: bottom right;
  transform: scale(0.88) translateY(10px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.22s ease;
  max-height: 640px;
  clip-path: inset(0 round 14px);
}

#chatbot-panel.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* Legacy inline chatbox — keep for backwards compat */
.chatbox {
  display: none;
}

/* ── Panel header ── */
.chat-header {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.85rem 1.1rem;
  background: #111;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  flex-shrink: 0;
}

.chat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #27ae60;
  flex-shrink: 0;
  animation: pulse-dot 2.2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}

.chat-title {
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
}

.chat-subtitle {
  color: #777;
  font-size: 0.72rem;
  margin-left: auto;
}

/* ── Messages area ── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: 370px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
}

/* ── Individual message rows ── */
.chat-msg {
  display: flex;
  max-width: 90%;
}

.chat-msg-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-msg-bot {
  align-self: flex-start;
}

.chat-bubble {
  padding: 0.55rem 0.9rem;
  border-radius: 16px;
  font-size: 0.845rem;
  line-height: 1.52;
  word-break: break-word;
}

.chat-msg-user .chat-bubble {
  background: #d35400;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-msg-bot .chat-bubble {
  background: #2a2a2a;
  color: #ddd;
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

/* ── Typing indicator ── */
.chat-typing .chat-bubble {
  padding: 0.6rem 1rem;
  display: inline-flex;
  gap: 4px;
}

.dot-typ {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #888;
  margin: 0 2px;
  animation: dot-blink 1.3s ease-in-out infinite;
}
.dot-typ:nth-child(2) { animation-delay: 0.2s; }
.dot-typ:nth-child(3) { animation-delay: 0.4s; }

@keyframes dot-blink {
  0%, 80%, 100% { opacity: 0.2; transform: translateY(0); }
  40%            { opacity: 1;   transform: translateY(-3px); }
}

/* ── Suggestion chips ── */
.chat-suggestions {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.4rem;
  padding: 0.55rem 0.9rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: #2a2a2a;
  flex-shrink: 0;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  width: 100%;
  box-sizing: border-box;
}

.chat-suggestions::-webkit-scrollbar {
  display: none;
}

.chip {
  background: #3a3a3a;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ddd;
  padding: 0.28rem 0.72rem;
  border-radius: 20px;
  font-size: 0.76rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  font-family: inherit;
  white-space: nowrap;
  flex-shrink: 0;
}

.chip:hover {
  background: #d35400;
  border-color: #d35400;
  color: #fff;
}

/* ── Input row ── */
.chat-input {
  display: flex;
  align-items: center;
  padding: 0.65rem 0.9rem;
  gap: 0.5rem;
  background: #1c1c1c;
  border-top: 1px solid rgba(255,255,255,0.05);
  flex-shrink: 0;
}

.chat-input input {
  flex: 1;
  background: #2a2a2a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 0.45rem 0.9rem;
  color: #e0e0e0;
  font-size: 0.82rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  min-width: 0;
}

.chat-input input:focus    { border-color: #d35400; }
.chat-input input::placeholder { color: #555; }

.chat-input button[type="submit"] {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #d35400;
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  transition: background 0.15s, transform 0.15s;
  flex-shrink: 0;
}

.chat-input button[type="submit"]:hover {
  background: #e67e22;
  transform: scale(1.08);
}

/* ── Skill tags (used in Skills section on white page bg) ── */
.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.6rem;
  margin-bottom: 1.2rem;
}

.skill-tag {
  display: inline-block;
  background: rgba(0, 0, 0, 0.055);
  border: 1px solid rgba(0, 0, 0, 0.15);
  color: #333;
  padding: 0.22rem 0.65rem;
  border-radius: 3px;
  font-size: 0.82em;
  letter-spacing: 0.02em;
}

/* ── Language switcher (trilingual version) ── */
.lang-switch {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: 1rem;
}

.lang-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.45);
  font-size: 0.78rem;
  font-family: inherit;
  cursor: pointer;
  padding: 0.15rem 0.35rem;
  border-radius: 3px;
  letter-spacing: 0.04em;
  transition: color 0.15s, background 0.15s;
  line-height: 1;
}

.lang-btn:hover,
.lang-btn.active {
  color: #fff;
  background: rgba(255,255,255,0.1);
}

.lang-sep {
  color: rgba(255,255,255,0.2);
  font-size: 0.7rem;
  user-select: none;
}

/* ── Mobile adjustments ── */
@media screen and (max-width: 480px) {
  #chatbot-widget {
    bottom: 1rem;
    right: 1rem;
  }

  #chatbot-panel {
    width: calc(100vw - 2rem);
    right: 0;
  }
}
