/* ============================================================
   SMB AI Ally — Chatbot Widget
   Dark Navy + Gold theme matching site design system
   ============================================================ */

/* ---- Launcher Button ---- */
#ally-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d4af37, #b8941f);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(212, 175, 55, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#ally-launcher:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(212, 175, 55, 0.55);
}

#ally-launcher svg {
  width: 26px;
  height: 26px;
  fill: #020617;
}

/* ---- Chat Window ---- */
#ally-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 360px;
  height: 520px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  z-index: 9998;
  overflow: hidden;
  transform: translateY(16px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

#ally-window.ally-open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* ---- Header ---- */
#ally-header {
  background: #1e293b;
  border-bottom: 1px solid #334155;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.ally-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d4af37, #b8941f);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.ally-header-text {
  flex: 1;
}

.ally-header-text strong {
  display: block;
  color: #f1f5f9;
  font-size: 14px;
  font-family: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
  font-weight: 600;
}

.ally-header-text span {
  color: #94a3b8;
  font-size: 12px;
  font-family: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
}

#ally-close {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 6px;
  transition: color 0.15s;
}

#ally-close:hover {
  color: #f1f5f9;
}

/* ---- Messages Area ---- */
#ally-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #020617;
}

#ally-messages::-webkit-scrollbar {
  width: 4px;
}

#ally-messages::-webkit-scrollbar-track {
  background: transparent;
}

#ally-messages::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}

/* ---- Message Bubbles ---- */
.ally-bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 18px;
  font-family: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  word-wrap: break-word;
}

.ally-bubble.bot {
  background: #1e293b;
  color: #cbd5e1;
  border: 1px solid #334155;
  border-radius: 4px 18px 18px 18px;
  align-self: flex-start;
}

.ally-bubble.user {
  background: linear-gradient(135deg, #d4af37, #b8941f);
  color: #020617;
  font-weight: 500;
  border-radius: 18px 4px 18px 18px;
  align-self: flex-end;
}

/* ---- Typing Indicator (Three Moving Dots) ---- */
.ally-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
}

.ally-dot {
  width: 7px;
  height: 7px;
  background-color: #d4af37;
  border-radius: 50%;
  animation: allyBounce 1.4s infinite ease-in-out;
}

.ally-dot:nth-child(1) { animation-delay: 0s; }
.ally-dot:nth-child(2) { animation-delay: 0.2s; }
.ally-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes allyBounce {
  0%, 80%, 100% { transform: translateY(0);   opacity: 0.35; }
  40%           { transform: translateY(-6px); opacity: 1;    }
}

/* ---- Input Area ---- */
#ally-input-area {
  padding: 12px 14px;
  border-top: 1px solid #334155;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #0f172a;
  flex-shrink: 0;
}

#ally-input {
  flex: 1;
  border: 1px solid #334155;
  border-radius: 24px;
  padding: 9px 16px;
  font-size: 14px;
  font-family: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
  outline: none;
  background: #1e293b;
  color: #f1f5f9;
  transition: border-color 0.15s;
}

#ally-input::placeholder {
  color: #64748b;
}

#ally-input:focus {
  border-color: #d4af37;
}

#ally-input:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

#ally-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d4af37, #b8941f);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s, transform 0.15s;
}

#ally-send:hover:not(:disabled) {
  opacity: 0.9;
  transform: scale(1.05);
}

#ally-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

#ally-send svg {
  width: 16px;
  height: 16px;
  fill: #020617;
}

/* ---- Footer Note ---- */
#ally-footer-note {
  text-align: center;
  font-size: 11px;
  color: #475569;
  padding: 5px 14px 9px;
  font-family: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
  background: #0f172a;
  flex-shrink: 0;
}

/* ---- Mobile: full screen ---- */
@media (max-width: 480px) {
  #ally-window {
    bottom: 0;
    right: 0;
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
  }

  #ally-launcher {
    bottom: 16px;
    right: 16px;
  }
}
