/* support-widget.css - ShopV 24/7 客服悬浮窗样式 */
(function(){})(); /* placeholder, real CSS below */

/* ===== ShopV Support Widget ===== */
#shopv-support-root {
  position: fixed;
  z-index: 999999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Noto Sans SC", sans-serif;
}

/* 悬浮按钮 */
.support-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 999999;
  border: none;
  animation: supportFabPulse 2s ease-in-out infinite;
}

.support-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(102, 126, 234, 0.5);
}

.support-fab.active {
  animation: none;
}

.support-fab svg {
  width: 28px;
  height: 28px;
  fill: #fff;
}

.support-fab-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  background: #ff453a;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  border: 2px solid #fff;
}

/* 聊天窗口 */
.support-chat-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 560px;
  max-height: calc(100vh - 130px);
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 999998;
}

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

/* 头部 */
.support-chat-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.support-chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.support-chat-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
}

.support-chat-status {
  font-size: 12px;
  opacity: 0.85;
  display: flex;
  align-items: center;
  gap: 4px;
}

.support-chat-status::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #30d158;
  display: inline-block;
}

.support-chat-status.offline::before {
  background: #ff9f0a;
}

.support-chat-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background 0.2s;
  line-height: 1;
}

.support-chat-close:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* 消息区域 */
.support-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f5f5f7;
  scroll-behavior: smooth;
}

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

.support-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 4px;
}

/* 消息气泡 */
.support-msg {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
  animation: supportMsgIn 0.3s ease-out;
}

.support-msg.customer {
  align-self: flex-end;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.support-msg.agent,
.support-msg.bot {
  align-self: flex-start;
  background: #fff;
  color: #1a1a1a;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.support-msg.system {
  align-self: center;
  background: rgba(0, 0, 0, 0.05);
  color: #8e8e93;
  font-size: 12px;
  padding: 6px 12px;
}

.support-msg-time {
  font-size: 11px;
  color: #8e8e93;
  margin-top: 4px;
  text-align: right;
}

.support-msg.customer .support-msg-time {
  color: rgba(255, 255, 255, 0.7);
}

/* 打字指示器 */
.support-typing {
  align-self: flex-start;
  background: #fff;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  padding: 12px 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  display: flex;
  gap: 4px;
}

.support-typing span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c7c7cc;
  animation: supportTypingDot 1.4s infinite ease-in-out;
}

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

/* 快捷链接区 */
.support-quick-links {
  padding: 10px 16px;
  background: #fff;
  border-top: 1px solid #e5e5ea;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  flex-shrink: 0;
}

.support-quick-link {
  padding: 6px 14px;
  border-radius: 20px;
  background: #f0f0f5;
  color: #667eea;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  flex-shrink: 0;
}

.support-quick-link:hover {
  background: #e8e8f0;
}

/* 输入区 */
.support-chat-input {
  padding: 12px 16px;
  background: #fff;
  border-top: 1px solid #e5e5ea;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
}

.support-chat-input textarea {
  flex: 1;
  border: 1px solid #e5e5ea;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  max-height: 100px;
  min-height: 40px;
  outline: none;
  transition: border-color 0.2s;
  line-height: 1.4;
}

.support-chat-input textarea:focus {
  border-color: #667eea;
}

.support-chat-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.support-chat-send:hover {
  transform: scale(1.05);
}

.support-chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.support-chat-send svg {
  width: 20px;
  height: 20px;
  fill: #fff;
}

/* 评价面板 */
.support-rating-panel {
  padding: 20px;
  text-align: center;
  background: #fff;
  animation: supportMsgIn 0.3s ease-out;
}

.support-rating-panel h4 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #1a1a1a;
}

.support-rating-panel p {
  font-size: 13px;
  color: #8e8e93;
  margin-bottom: 16px;
}

.support-rating-stars {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
}

.support-rating-star {
  font-size: 28px;
  cursor: pointer;
  color: #e0e0e0;
  transition: color 0.15s;
  user-select: none;
}

.support-rating-star:hover,
.support-rating-star.active {
  color: #ff9f0a;
}

.support-rating-textarea {
  width: 100%;
  border: 1px solid #e5e5ea;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  height: 70px;
  outline: none;
  margin-bottom: 12px;
  box-sizing: border-box;
}

.support-rating-textarea:focus {
  border-color: #667eea;
}

.support-rating-submit {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.support-rating-submit:hover {
  opacity: 0.9;
}

/* 知识库面板 */
.support-kb-panel {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f5f5f7;
}

.support-kb-search {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.support-kb-search input {
  flex: 1;
  border: 1px solid #e5e5ea;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  outline: none;
}

.support-kb-search input:focus {
  border-color: #667eea;
}

.support-kb-search button {
  padding: 8px 16px;
  border-radius: 10px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  font-size: 13px;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}

.support-kb-category {
  margin-bottom: 12px;
}

.support-kb-category-title {
  font-size: 13px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.support-kb-article {
  display: block;
  padding: 10px 14px;
  background: #fff;
  border-radius: 10px;
  margin-bottom: 6px;
  font-size: 13px;
  color: #1a1a1a;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.support-kb-article:hover {
  background: #f0f0f5;
}

.support-kb-article-excerpt {
  font-size: 12px;
  color: #8e8e93;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.support-kb-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: #667eea;
  cursor: pointer;
  margin-bottom: 12px;
  border: none;
  background: none;
  font-family: inherit;
}

.support-kb-article-detail {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  font-size: 14px;
  line-height: 1.6;
  color: #1a1a1a;
}

.support-kb-article-detail h2 {
  font-size: 18px;
  margin-bottom: 12px;
}

/* 动画 */
@keyframes supportFabPulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4); }
  50% { box-shadow: 0 4px 30px rgba(102, 126, 234, 0.6); }
}

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

@keyframes supportTypingDot {
  0%, 60%, 100% { transform: scale(0.7); opacity: 0.5; }
  30% { transform: scale(1); opacity: 1; }
}

/* 移动端适配 */
@media (max-width: 768px) {
  .support-fab {
    bottom: 16px;
    right: 16px;
    width: 52px;
    height: 52px;
  }

  .support-fab svg {
    width: 24px;
    height: 24px;
  }

  .support-chat-window {
    bottom: 0;
    right: 0;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
  }

  .support-chat-window.open {
    transform: translateY(0) scale(1);
  }

  .support-chat-input {
    padding: 10px 12px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }
}
