/* ============================================================
   CLOUDIX AI — chatbot.css
   ============================================================ */

/* ── Toggle Button ────────────────────────────────────────── */
.chat-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1100;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #00e5a8;
  color: #00291f;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0, 229, 168, 0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chat-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(0, 229, 168, 0.55);
}

.chat-toggle svg {
  width: 24px;
  height: 24px;
  transition: opacity 0.15s ease;
}

.chat-toggle .icon-open  { display: block; }
.chat-toggle .icon-close { display: none; }

.chat-toggle.is-open .icon-open  { display: none; }
.chat-toggle.is-open .icon-close { display: block; }

/* ── Chat Panel ───────────────────────────────────────────── */
.chat-panel {
  position: fixed;
  bottom: 92px;
  right: 24px;
  z-index: 1099;
  width: 320px;
  height: 420px;
  background: #111716;
  border: 1px solid rgba(0, 229, 168, 0.18);
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  overflow: hidden;

  /* closed state */
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

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

/* ── Header ───────────────────────────────────────────────── */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #0b0f0e;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(0, 229, 168, 0.12);
  border: 1px solid rgba(0, 229, 168, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.chat-header-text {
  display: flex;
  flex-direction: column;
}

.chat-header-name {
  font-size: 0.875rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
}

.chat-header-status {
  font-size: 0.6875rem;
  color: #00e5a8;
  margin-top: 1px;
}

.chat-close {
  background: none;
  border: none;
  cursor: pointer;
  color: #6b7a74;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: color 0.15s ease, background 0.15s ease;
}

.chat-close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
}

/* ── Messages ─────────────────────────────────────────────── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

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

/* Message bubble */
.chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 82%;
}

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

.chat-bubble {
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 0.8125rem;
  line-height: 1.55;
}

.chat-msg--bot  .chat-bubble {
  background: #1a2420;
  color: #cfd6d3;
  border-bottom-left-radius: 3px;
}

.chat-msg--user .chat-bubble {
  background: #00e5a8;
  color: #00291f;
  font-weight: 500;
  border-bottom-right-radius: 3px;
}

.chat-msg-time {
  font-size: 0.625rem;
  color: #4a5c55;
  margin-top: 3px;
}

.chat-msg--user .chat-msg-time { text-align: right; }

/* Typing indicator */
.chat-typing .chat-bubble {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 14px;
}

.chat-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #00e5a8;
  opacity: 0.5;
  animation: typingPulse 1.2s ease-in-out infinite;
}

.chat-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.chat-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingPulse {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30%           { opacity: 1;   transform: translateY(-3px); }
}

/* ── Input Area ───────────────────────────────────────────── */
.chat-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: #0b0f0e;
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  background: #1a2420;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 9px 14px;
  font-size: 0.8125rem;
  color: #cfd6d3;
  outline: none;
  transition: border-color 0.15s ease;
  font-family: inherit;
}

.chat-input::placeholder { color: #4a5c55; }

.chat-input:focus { border-color: rgba(0, 229, 168, 0.35); }

.chat-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #00e5a8;
  color: #00291f;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s ease, transform 0.15s ease;
}

.chat-send:hover { background: #00c896; transform: scale(1.05); }

.chat-send svg { width: 16px; height: 16px; }

/* ── Mobile ───────────────────────────────────────────────── */
@media (max-width: 480px) {
  .chat-panel {
    width: calc(100vw - 24px);
    right: 12px;
    bottom: 84px;
    height: 70vh;
    max-height: 520px;
  }

  .chat-toggle {
    right: 16px;
    bottom: 16px;
  }
}
