/* ============================================
   ATAMAP ASSOCIATES — Friday AI Chatbot
   Clid Integration Widget
   ============================================ */

/* ---- Chat Toggle Button ---- */
.chat-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: var(--z-overlay);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-accent);
  color: var(--color-navy-900);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  transition: transform var(--duration-normal) var(--ease-spring-1),
              box-shadow var(--duration-normal) var(--ease-spring-settle);
}

.chat-toggle:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-xl), 0 0 30px rgba(200, 164, 92, 0.3);
}

.chat-toggle:active {
  transform: scale(0.95);
  transition-duration: var(--duration-fast);
}

.chat-toggle svg {
  width: 24px;
  height: 24px;
}

.chat-toggle__badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  background: var(--color-danger);
  border-radius: 50%;
  border: 2px solid var(--color-navy-800);
  display: none;
}

.chat-toggle__badge.is-visible {
  display: block;
}

/* ---- Chat Window ---- */
.chat-window {
  position: fixed;
  bottom: 92px;
  right: 24px;
  z-index: var(--z-modal);
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 520px;
  max-height: calc(100vh - 120px);
  background: var(--color-navy-800);
  border: 1px solid var(--color-graphite-500);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(0.95);
  pointer-events: none;
  transition: opacity var(--duration-normal) var(--ease-spring-1),
              transform var(--duration-normal) var(--ease-spring-1);
}

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

/* ---- Chat Header ---- */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  background: var(--color-navy-700);
  border-bottom: 1px solid var(--color-graphite-500);
  flex-shrink: 0;
}

.chat-header__info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.chat-header__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-accent-dim);
  border: 1px solid var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-accent);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
}

.chat-header__title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-white);
}

.chat-header__status {
  font-size: var(--font-size-xs);
  color: var(--color-success);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.chat-header__status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-success);
  display: inline-block;
}

.chat-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: var(--color-steel-400);
  cursor: pointer;
  border-radius: var(--border-radius-md);
  transition: color var(--duration-fast) var(--ease-spring-settle),
              background var(--duration-fast) var(--ease-spring-settle);
}

.chat-close:hover {
  color: var(--color-white);
  background: var(--color-navy-600);
}

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

/* ---- Chat Messages ---- */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--color-graphite-500);
  border-radius: 2px;
}

.chat-message {
  max-width: 85%;
  animation: chatMessageIn var(--duration-normal) var(--ease-spring-1) both;
}

@keyframes chatMessageIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.chat-message--user {
  align-self: flex-end;
}

.chat-message__bubble {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--border-radius-lg);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-relaxed);
}

.chat-message--bot .chat-message__bubble {
  background: var(--color-navy-700);
  border: 1px solid var(--color-graphite-500);
  color: var(--color-silver-200);
  border-bottom-left-radius: var(--border-radius-sm);
}

.chat-message--user .chat-message__bubble {
  background: var(--color-accent);
  color: var(--color-navy-900);
  border-bottom-right-radius: var(--border-radius-sm);
}

.chat-message__time {
  font-size: 10px;
  color: var(--color-steel-400);
  margin-top: var(--space-1);
  padding-inline: var(--space-1);
}

.chat-message--bot .chat-message__time {
  text-align: left;
}

.chat-message--user .chat-message__time {
  text-align: right;
}

/* Quick reply buttons inside bot messages */
.chat-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.chat-quick-reply {
  padding: var(--space-1) var(--space-3);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  color: var(--color-accent);
  border: 1px solid var(--color-accent);
  border-radius: 20px;
  background: transparent;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-spring-settle);
  font-family: var(--font-family);
}

.chat-quick-reply:hover {
  background: var(--color-accent-dim);
}

/* ---- Typing Indicator ---- */
.chat-typing {
  align-self: flex-start;
  display: none;
  padding: var(--space-3) var(--space-4);
  background: var(--color-navy-700);
  border: 1px solid var(--color-graphite-500);
  border-radius: var(--border-radius-lg);
  border-bottom-left-radius: var(--border-radius-sm);
}

.chat-typing.is-visible {
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-typing__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-steel-400);
  animation: typingBounce 1.4s 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 typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-4px); }
}

/* ---- Chat Input ---- */
.chat-input {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--color-graphite-500);
  background: var(--color-navy-700);
  flex-shrink: 0;
}

.chat-input__field {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  background: var(--color-navy-800);
  border: 1px solid var(--color-graphite-500);
  border-radius: 20px;
  color: var(--color-white);
  font-size: var(--font-size-sm);
  font-family: var(--font-family);
  outline: none;
  transition: border-color var(--duration-fast) var(--ease-spring-settle);
}

.chat-input__field:focus {
  border-color: var(--color-accent);
}

.chat-input__field::placeholder {
  color: var(--color-steel-400);
}

.chat-input__send {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--color-accent);
  color: var(--color-navy-900);
  border-radius: 50%;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-spring-1);
  flex-shrink: 0;
}

.chat-input__send:hover {
  background: var(--color-accent-hover);
  transform: scale(1.05);
}

.chat-input__send:active {
  transform: scale(0.95);
}

.chat-input__send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

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

/* ---- Chat Disclaimer ---- */
.chat-disclaimer {
  padding: var(--space-2) var(--space-4);
  font-size: 10px;
  color: var(--color-steel-400);
  text-align: center;
  background: var(--color-navy-900);
  border-top: 1px solid rgba(55, 65, 81, 0.3);
  flex-shrink: 0;
}

/* ---- Mobile adjustments ---- */
@media (max-width: 480px) {
  .chat-window {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }

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

/* ---- Reduced Motion ---- */
@media (prefers-reduced-motion: reduce) {
  .chat-window {
    transition: none;
  }

  .chat-message {
    animation: none;
  }

  .chat-typing__dot {
    animation: none;
  }
}
