/* CROPRO sales chatbot — đồng bộ palette landing */
.cro-chat {
  --chat-primary: var(--primary, #ff4d00);
  --chat-primary-hover: var(--primary-hover, #cc3d00);
  --chat-bg: #141414;
  --chat-bg-elevated: #1c1c1c;
  --chat-border: rgba(255, 255, 255, 0.08);
  --chat-bot-bubble: #252525;
  --chat-user-bubble: linear-gradient(135deg, #ff4d00 0%, #e63900 100%);
  --chat-text: #fafafa;
  --chat-muted: #a1a1aa;
  --chat-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);

  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  font-family: var(--font-body, 'Barlow', sans-serif);
}

.cro-chat-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  background: linear-gradient(135deg, var(--chat-primary) 0%, #e63900 100%);
  color: #fff;
  box-shadow: var(--chat-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cro-chat-toggle:hover {
  transform: scale(1.06);
  box-shadow: 0 14px 32px rgba(255, 77, 0, 0.35);
}

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

.cro-chat-toggle .icon-close {
  display: none;
}

.cro-chat.is-open .cro-chat-toggle .icon-chat {
  display: none;
}

.cro-chat.is-open .cro-chat-toggle .icon-close {
  display: block;
}

.cro-chat-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid var(--bg-dark, #0a0a0a);
  animation: cro-chat-pulse 2s ease infinite;
}

@keyframes cro-chat-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.85; }
}

.cro-chat-panel {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: min(380px, calc(100vw - 32px));
  max-height: min(520px, calc(100vh - 120px));
  display: flex;
  flex-direction: column;
  background: var(--chat-bg);
  border: 1px solid var(--chat-border);
  border-radius: 16px;
  box-shadow: var(--chat-shadow);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.96);
  transform-origin: bottom right;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
  pointer-events: none;
}

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

.cro-chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--chat-bg-elevated);
  border-bottom: 1px solid var(--chat-border);
}

.cro-chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display, 'Barlow Condensed', sans-serif);
  font-weight: 800;
  font-size: 1.1rem;
  background: rgba(255, 77, 0, 0.15);
  color: var(--chat-primary);
  border: 1px solid rgba(255, 77, 0, 0.35);
}

.cro-chat-header-text h3 {
  font-family: var(--font-display, 'Barlow Condensed', sans-serif);
  font-size: 1.05rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--chat-text);
  margin: 0;
  line-height: 1.2;
}

.cro-chat-header-text p {
  margin: 2px 0 0;
  font-size: 0.75rem;
  color: var(--chat-muted);
}

.cro-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.cro-chat-msg {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--chat-text);
  word-break: break-word;
}

.cro-chat-msg strong {
  color: #fff;
  font-weight: 600;
}

.cro-chat-msg--bot {
  align-self: flex-start;
  background: var(--chat-bot-bubble);
  border-bottom-left-radius: 4px;
}

.cro-chat-msg--user {
  align-self: flex-end;
  background: var(--chat-user-bubble);
  border-bottom-right-radius: 4px;
}

.cro-chat-msg--typing {
  align-self: flex-start;
  padding: 12px 16px;
}

.cro-chat-dots span {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin: 0 2px;
  border-radius: 50%;
  background: var(--chat-muted);
  animation: cro-chat-dot 1.2s infinite;
}

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

@keyframes cro-chat-dot {
  0%, 80%, 100% { opacity: 0.35; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-4px); }
}

.cro-chat-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 14px 10px;
}

.cro-chat-quick-btn {
  padding: 6px 10px;
  font-size: 0.75rem;
  font-family: inherit;
  color: var(--chat-text);
  background: transparent;
  border: 1px solid rgba(255, 77, 0, 0.45);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.cro-chat-quick-btn:hover {
  background: rgba(255, 77, 0, 0.12);
  border-color: var(--chat-primary);
}

.cro-chat-footer {
  padding: 10px 12px 12px;
  border-top: 1px solid var(--chat-border);
  background: var(--chat-bg-elevated);
}

.cro-chat-input-row {
  display: flex;
  gap: 8px;
}

.cro-chat-input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--chat-text);
  background: #0a0a0a;
  border: 1px solid var(--chat-border);
  border-radius: 10px;
  outline: none;
}

.cro-chat-input:focus {
  border-color: rgba(255, 77, 0, 0.6);
}

.cro-chat-input::placeholder {
  color: var(--chat-muted);
}

.cro-chat-send {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  background: var(--chat-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.cro-chat-send:hover {
  background: var(--chat-primary-hover);
}

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

.cro-chat-cta-wrap {
  padding: 0 14px 12px;
}

.cro-chat-cta {
  display: block;
  width: 100%;
  padding: 12px 14px;
  text-align: center;
  font-family: var(--font-display, 'Barlow Condensed', sans-serif);
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #fff;
  background: linear-gradient(135deg, var(--chat-primary) 0%, #e63900 100%);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 14px rgba(255, 77, 0, 0.25);
}

.cro-chat-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(255, 77, 0, 0.35);
}

@media (max-width: 480px) {
  .cro-chat {
    bottom: 16px;
    right: 16px;
  }

  .cro-chat-panel {
    bottom: 68px;
    width: calc(100vw - 32px);
    max-height: min(480px, calc(100vh - 100px));
  }
}
