/* ============================================
   ALEJOS CONSTRUCTION - AI CHATBOT STYLES
   Custom design: Tool + Leaf icon (not bubble)
   ============================================ */

:root {
  --ac-primary: #34a552;
  --ac-primary-dark: #166534;
  --ac-secondary: #0b2210;
  --ac-bg: #050e06;
  --ac-surface: #0f1f12;
  --ac-surface-light: #1a2e1d;
  --ac-text: #ffffff;
  --ac-text-muted: rgba(255,255,255,0.6);
  --ac-text-dim: rgba(255,255,255,0.4);
  --ac-border: rgba(255,255,255,0.1);
  --ac-shadow: rgba(0,0,0,0.4);
  --ac-font: 'Syne', 'Inter', sans-serif;
  --ac-radius: 16px;
}

/* ============================================
   FLOATING TRIGGER - SIMPLE LABEL DESIGN
   Left side, just text button
   ============================================ */
.ac-chat-trigger {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 9998;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  background: linear-gradient(135deg, var(--ac-primary-dark), var(--ac-primary));
  padding: 14px 22px;
  border-radius: 30px;
  box-shadow: 0 6px 24px rgba(52, 165, 82, 0.35);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ac-chat-trigger:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 10px 32px rgba(52, 165, 82, 0.45);
}

/* Chat icon */
.ac-trigger-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ac-trigger-icon svg {
  width: 100%;
  height: 100%;
}

/* Label text */
.ac-trigger-label {
  color: white;
  font-family: var(--ac-font);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* Notification badge */
.ac-trigger-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  background: #ef4444;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--ac-font);
  font-size: 11px;
  font-weight: 700;
  color: white;
  animation: acBadgePulse 2s ease-in-out infinite;
  opacity: 0;
  transform: scale(0);
  transition: all 0.3s ease;
}

.ac-trigger-badge.visible {
  opacity: 1;
  transform: scale(1);
}

@keyframes acBadgePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

/* ============================================
   CHAT CONTAINER
   ============================================ */
.ac-chat-container {
  position: fixed;
  bottom: 90px;
  left: 24px;
  width: 380px;
  height: 540px;
  background: var(--ac-bg);
  border-radius: var(--ac-radius);
  box-shadow: 0 20px 60px var(--ac-shadow), 0 0 0 1px var(--ac-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ac-chat-container.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* ============================================
   CHAT HEADER
   ============================================ */
.ac-chat-header {
  background: linear-gradient(135deg, var(--ac-secondary) 0%, var(--ac-surface) 100%);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--ac-border);
  flex-shrink: 0;
}

.ac-header-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--ac-primary-dark), var(--ac-primary));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(52, 165, 82, 0.3);
}

.ac-header-avatar svg {
  width: 26px;
  height: 26px;
}

.ac-header-info {
  flex: 1;
  min-width: 0;
}

.ac-header-title {
  font-family: var(--ac-font);
  font-weight: 800;
  font-size: 15px;
  color: var(--ac-text);
  margin: 0 0 3px 0;
  letter-spacing: -0.02em;
}

.ac-header-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--ac-font);
  font-size: 11px;
  color: var(--ac-text-muted);
}

.ac-status-dot {
  width: 7px;
  height: 7px;
  background: var(--ac-primary);
  border-radius: 50%;
  animation: acStatusPulse 2s ease-in-out infinite;
}

@keyframes acStatusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.ac-header-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ac-text-muted);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.ac-header-close:hover {
  background: rgba(255,255,255,0.15);
  color: var(--ac-text);
}

/* ============================================
   MESSAGES AREA
   ============================================ */
.ac-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

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

.ac-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.ac-chat-messages::-webkit-scrollbar-thumb {
  background: var(--ac-border);
  border-radius: 3px;
}

/* Message bubbles */
.ac-message {
  max-width: 85%;
  animation: acMessageIn 0.3s ease-out;
}

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

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

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

.ac-message-content {
  padding: 12px 16px;
  border-radius: 16px;
  font-family: var(--ac-font);
  font-size: 14px;
  line-height: 1.55;
}

.ac-message.user .ac-message-content {
  background: linear-gradient(135deg, var(--ac-primary-dark), var(--ac-primary));
  color: white;
  border-bottom-right-radius: 6px;
}

.ac-message.bot .ac-message-content {
  background: var(--ac-surface-light);
  color: var(--ac-text);
  border-bottom-left-radius: 6px;
  border: 1px solid var(--ac-border);
}

.ac-message-content a {
  color: var(--ac-primary);
  text-decoration: underline;
}

.ac-message-content strong {
  font-weight: 700;
}

.ac-message-content ul, .ac-message-content ol {
  margin: 8px 0;
  padding-left: 18px;
}

.ac-message-content li {
  margin: 4px 0;
}

/* Typing indicator */
.ac-typing {
  display: flex;
  gap: 5px;
  padding: 14px 18px;
  background: var(--ac-surface-light);
  border-radius: 16px;
  border-bottom-left-radius: 6px;
  width: fit-content;
  border: 1px solid var(--ac-border);
}

.ac-typing span {
  width: 8px;
  height: 8px;
  background: var(--ac-primary);
  border-radius: 50%;
  animation: acTypingDot 1.4s ease-in-out infinite;
}

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

@keyframes acTypingDot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* ============================================
   QUICK BUTTONS
   ============================================ */
.ac-quick-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 20px 12px;
  flex-shrink: 0;
}

.ac-quick-btn {
  padding: 10px 16px;
  background: transparent;
  border: 1px solid var(--ac-border);
  border-radius: 20px;
  color: var(--ac-text);
  font-family: var(--ac-font);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
}

.ac-quick-btn:hover {
  background: var(--ac-primary);
  border-color: var(--ac-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(52, 165, 82, 0.3);
}

/* ============================================
   INPUT AREA
   ============================================ */
.ac-chat-input {
  padding: 16px 20px;
  background: var(--ac-surface);
  border-top: 1px solid var(--ac-border);
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-shrink: 0;
}

.ac-input-wrapper {
  flex: 1;
  position: relative;
}

.ac-input-wrapper textarea {
  width: 100%;
  min-height: 44px;
  max-height: 120px;
  padding: 12px 16px;
  background: var(--ac-bg);
  border: 1px solid var(--ac-border);
  border-radius: 12px;
  color: var(--ac-text);
  font-family: var(--ac-font);
  font-size: 14px;
  line-height: 1.4;
  resize: none;
  outline: none;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
}

.ac-input-wrapper textarea::placeholder {
  color: var(--ac-text-dim);
}

.ac-input-wrapper textarea:focus {
  border-color: var(--ac-primary);
}

.ac-send-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--ac-primary-dark), var(--ac-primary));
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: all 0.25s ease;
  flex-shrink: 0;
}

.ac-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(52, 165, 82, 0.4);
}

.ac-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 480px) {
  .ac-chat-container {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
    max-height: 100dvh;
  }

  .ac-chat-trigger {
    left: 16px;
    padding: 12px 18px;
  }

  .ac-trigger-label {
    font-size: 13px;
  }
}
