/* ============================================================
   webdevelop.ro — Chat Widget
   Floating AI assistant
   ============================================================ */

.chat-widget {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
  font-family: var(--f-body, 'DM Sans', -apple-system, sans-serif);
}

/* ====================== TOGGLE BUTTON ====================== */
.chat-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--c-accent, #8B7355);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(139, 115, 85, 0.35);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.chat-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(139, 115, 85, 0.45);
}

.chat-toggle svg {
  width: 26px;
  height: 26px;
  transition: all 0.3s;
}

.chat-toggle--open .chat-toggle__icon-chat { display: none; }
.chat-toggle--open .chat-toggle__icon-close { display: block; }
.chat-toggle:not(.chat-toggle--open) .chat-toggle__icon-close { display: none; }

/* Pulse animation on load */
.chat-toggle::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--c-accent, #8B7355);
  opacity: 0;
  animation: chat-pulse 3s ease-out 2s 3;
}

@keyframes chat-pulse {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.4); opacity: 0; }
}

/* Badge notification */
.chat-toggle__badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  background: #34C759;
  border-radius: 50%;
  border: 2.5px solid #fff;
  display: block;
}

.chat-toggle--open .chat-toggle__badge { display: none; }

/* ====================== CHAT WINDOW ====================== */
.chat-window {
  position: absolute;
  bottom: 76px;
  right: 0;
  width: 380px;
  max-height: 520px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 12px 60px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px) scale(0.96);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* ====================== HEADER ====================== */
.chat-header {
  padding: 1.25rem 1.5rem;
  background: var(--c-accent, #8B7355);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.chat-header__avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  flex-shrink: 0;
}

.chat-header__info { flex: 1; }

.chat-header__name {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.2;
}

.chat-header__status {
  font-size: 0.75rem;
  opacity: 0.8;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.chat-header__status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34C759;
}

/* ====================== MESSAGES ====================== */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  min-height: 280px;
  max-height: 340px;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: #E0E0DC; border-radius: 4px; }

.chat-msg {
  max-width: 85%;
  padding: 0.75rem 1rem;
  border-radius: 16px;
  font-size: 0.875rem;
  line-height: 1.55;
  animation: chat-msg-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.chat-msg--bot {
  background: #F3F2EE;
  color: #1A1A18;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.chat-msg--user {
  background: var(--c-accent, #8B7355);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.chat-msg--bot a {
  color: var(--c-accent, #8B7355);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Typing indicator */
.chat-typing {
  display: flex;
  gap: 4px;
  padding: 0.75rem 1rem;
  background: #F3F2EE;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  max-width: 70px;
}

.chat-typing__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9C9C95;
  animation: chat-typing-bounce 1.4s infinite;
}

.chat-typing__dot:nth-child(2) { animation-delay: 0.15s; }
.chat-typing__dot:nth-child(3) { animation-delay: 0.3s; }

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

/* Quick actions */
.chat-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.chat-quick-btn {
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--c-accent, #8B7355);
  background: rgba(139, 115, 85, 0.06);
  border: 1px solid rgba(139, 115, 85, 0.15);
  padding: 0.4375rem 0.875rem;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.25s;
  white-space: nowrap;
}

.chat-quick-btn:hover {
  background: rgba(139, 115, 85, 0.12);
  border-color: var(--c-accent, #8B7355);
}

/* ====================== INPUT ====================== */
.chat-input-wrap {
  padding: 0.875rem 1.25rem;
  border-top: 1px solid #F0EFEB;
  display: flex;
  gap: 0.625rem;
  align-items: center;
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  font-family: inherit;
  font-size: 0.875rem;
  color: #1A1A18;
  background: #F7F7F5;
  border: 1.5px solid transparent;
  border-radius: 12px;
  padding: 0.6875rem 1rem;
  outline: none;
  transition: all 0.25s;
}

.chat-input:focus {
  border-color: var(--c-accent, #8B7355);
  background: #fff;
}

.chat-input::placeholder { color: #9C9C95; }

.chat-send {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--c-accent, #8B7355);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s;
  flex-shrink: 0;
}

.chat-send:hover {
  background: var(--c-accent-hover, #745F45);
  transform: scale(1.05);
}

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

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

/* ====================== POWERED BY ====================== */
.chat-footer {
  text-align: center;
  padding: 0.5rem;
  font-size: 0.6875rem;
  color: #9C9C95;
  border-top: 1px solid #F7F7F5;
}

/* ====================== RESPONSIVE ====================== */
@media (max-width: 480px) {
  .chat-widget {
    bottom: 1rem;
    right: 1rem;
  }

  .chat-window {
    width: calc(100vw - 2rem);
    max-height: calc(100vh - 8rem);
    bottom: 72px;
    right: 0;
  }

  .chat-toggle {
    width: 54px;
    height: 54px;
  }
}
