/* Autotrimzone AI Chat Widget - Dark Theme with Gold Accent */
:root {
  --ag-chat-primary: #f5b942;
  --ag-chat-primary-dark: #e5a93a;
  --ag-chat-bg: #1c222e;
  --ag-chat-bg2: #171c25;
  --ag-chat-text: #eef1f6;
  --ag-chat-text-muted: #9aa3b2;
  --ag-chat-border: #262d3a;
  --ag-chat-shadow: 0 4px 20px rgba(0,0,0,0.4);
  --ag-chat-radius: 14px;
  --ag-chat-z: 99999;
}

/* 聊天按钮 */
.ag-chat-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ag-chat-primary), var(--ag-chat-primary-dark));
  color: #0d1015;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(245, 185, 66, 0.4);
  z-index: var(--ag-chat-z);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  transition: transform 0.2s, box-shadow 0.2s;
}
.ag-chat-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(245, 185, 66, 0.6);
}

/* 对话框 */
.ag-chat-dialog {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  max-height: 540px;
  background: var(--ag-chat-bg);
  border: 1px solid var(--ag-chat-border);
  border-radius: var(--ag-chat-radius);
  box-shadow: var(--ag-chat-shadow);
  z-index: var(--ag-chat-z);
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.ag-chat-dialog.open {
  display: flex;
}

/* 头部 */
.ag-chat-header {
  background: linear-gradient(135deg, var(--ag-chat-primary), var(--ag-chat-primary-dark));
  color: #0d1015;
  padding: 16px 18px;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.ag-chat-close {
  background: rgba(0,0,0,0.2);
  border: none;
  color: #0d1015;
  cursor: pointer;
  font-size: 18px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.ag-chat-close:hover {
  background: rgba(0,0,0,0.3);
}

/* 消息区域 */
.ag-chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  min-height: 220px;
  max-height: 360px;
  background: var(--ag-chat-bg);
}
.ag-chat-msgs::-webkit-scrollbar {
  width: 6px;
}
.ag-chat-msgs::-webkit-scrollbar-track {
  background: var(--ag-chat-bg2);
}
.ag-chat-msgs::-webkit-scrollbar-thumb {
  background: var(--ag-chat-border);
  border-radius: 3px;
}

/* 消息气泡 */
.ag-msg {
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: 16px;
  max-width: 85%;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.ag-msg.user {
  background: linear-gradient(135deg, var(--ag-chat-primary), var(--ag-chat-primary-dark));
  color: #0d1015;
  margin-left: auto;
  border-bottom-right-radius: 4px;
  font-weight: 500;
}
.ag-msg.bot {
  background: var(--ag-chat-bg2);
  color: var(--ag-chat-text);
  margin-right: auto;
  border-bottom-left-radius: 4px;
  border: 1px solid var(--ag-chat-border);
}
.ag-msg.typing {
  background: var(--ag-chat-bg2);
  color: var(--ag-chat-text-muted);
  margin-right: auto;
  border-bottom-left-radius: 4px;
  font-style: italic;
  border: 1px solid var(--ag-chat-border);
}

/* 输入区域 */
.ag-chat-input-wrap {
  display: flex;
  padding: 12px 14px;
  border-top: 1px solid var(--ag-chat-border);
  gap: 10px;
  background: var(--ag-chat-bg2);
}
.ag-chat-input {
  flex: 1;
  border: 1px solid var(--ag-chat-border);
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 14px;
  outline: none;
  background: var(--ag-chat-bg);
  color: var(--ag-chat-text);
  transition: border-color 0.2s;
}
.ag-chat-input:focus {
  border-color: var(--ag-chat-primary);
}
.ag-chat-input::placeholder {
  color: var(--ag-chat-text-muted);
}
.ag-chat-send {
  background: linear-gradient(135deg, var(--ag-chat-primary), var(--ag-chat-primary-dark));
  color: #0d1015;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}
.ag-chat-send:hover {
  transform: scale(1.05);
}

/* 移动端适配 */
@media (max-width: 768px) {
  .ag-chat-btn {
    bottom: 16px;
    right: 16px;
    width: 54px;
    height: 54px;
    font-size: 24px;
  }
  .ag-chat-dialog {
    bottom: 84px;
    right: 16px;
    width: calc(100vw - 32px);
    max-width: 380px;
  }
}
