/* ============================================================
   Ahmad AI Chat — chat.css
   Link this in your Umbraco template:
   <link rel="stylesheet" href="/css/chat.css" />
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600&family=DM+Mono:wght@400;500&display=swap');

/* ── wrapper ── */
#ahmad-chat-wrapper {
  max-width: 700px;
  margin: 48px auto;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.08), 0 8px 32px rgba(0,0,0,0.06);
}

/* ── header ── */
#chat-header {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 16px 20px;
  background: #0f172a;
  color: #fff;
}

#chat-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: 'DM Mono', monospace;
}

#chat-header-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#chat-name {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.1px;
}

#chat-status {
  font-size: 12px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 5px;
}

#chat-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  display: inline-block;
  animation: pulse-dot 2s infinite;
}

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

/* ── messages area ── */
#chat-messages {
  flex: 1;
  min-height: 380px;
  max-height: 460px;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #f8fafc;
}

.chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 76%;
  animation: msg-in 0.2s ease-out;
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

.msg-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 5px;
  color: #94a3b8;
}

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

.msg-bubble {
  padding: 11px 15px;
  border-radius: 18px;
  line-height: 1.6;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.chat-msg.bot .msg-bubble {
  background: #0f172a;
  color: #e2e8f0;
  border-bottom-left-radius: 4px;
}

.chat-msg.user .msg-bubble {
  background: #e2e8f0;
  color: #0f172a;
  border-bottom-right-radius: 4px;
}

/* ── typing indicator ── */
#chat-typing {
  align-self: flex-start;
  background: #0f172a;
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  padding: 13px 17px;
  display: flex;
  gap: 5px;
  align-items: center;
  margin: 0 16px 4px;
}

#chat-typing span {
  width: 7px;
  height: 7px;
  background: rgba(255,255,255,0.45);
  border-radius: 50%;
  animation: typing-bounce 1.2s infinite;
}

#chat-typing span:nth-child(2) { animation-delay: 0.18s; }
#chat-typing span:nth-child(3) { animation-delay: 0.36s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0);   opacity: 0.45; }
  30%            { transform: translateY(-5px); opacity: 1; }
}

/* ── suggestion chips ── */
#chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px 10px;
  background: #f8fafc;
  border-top: 1px solid #e4e4e7;
}

.suggestion-btn {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  color: #334155;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s;
  white-space: nowrap;
}

.suggestion-btn:hover {
  background: #0f172a;
  color: #f1f5f9;
  border-color: #0f172a;
  transform: translateY(-1px);
}

.suggestion-btn:active {
  transform: translateY(0);
}

/* ── input row ── */
#chat-input-row {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  gap: 10px;
  border-top: 1px solid #e4e4e7;
  background: #fff;
}

#chat-input {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 24px;
  padding: 10px 18px;
  font-size: 15px;
  font-family: 'DM Sans', sans-serif;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  background: #f8fafc;
  color: #0f172a;
}

#chat-input::placeholder { color: #94a3b8; }

#chat-input:focus {
  border-color: #3b82f6;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

#chat-input:disabled { opacity: 0.55; }

#chat-send-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: #0f172a;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}

#chat-send-btn:hover  { background: #1e293b; transform: scale(1.05); }
#chat-send-btn:active { transform: scale(0.95); }
#chat-send-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

/* ── scrollbar ── */
#chat-messages::-webkit-scrollbar       { width: 4px; }
#chat-messages::-webkit-scrollbar-track { background: transparent; }
#chat-messages::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/* ── responsive ── */
@media (max-width: 600px) {
  #ahmad-chat-wrapper {
    margin: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .chat-msg { max-width: 88%; }

  #chat-suggestions {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 14px;
    -webkit-overflow-scrolling: touch;
  }

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

  .suggestion-btn { flex-shrink: 0; }
}
