/* AI智能助手样式 - 现代化设计 */

/* 主容器 */
.ai-assistant-section {
  margin: 0.3rem auto;
  padding: 0 0.2rem;
  max-width: 16rem;
  position: relative;
}

.ai-assistant-container {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 1rem;
  box-shadow: 0 0.2rem 2rem rgba(102, 126, 234, 0.3);
  overflow: hidden;
  position: relative;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-assistant-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  z-index: 1;
}

/* 头部区域 */
.ai-assistant-header {
  padding: 0.3rem 0.32rem;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ai-header-left {
  display: flex;
  align-items: center;
  gap: 0.24rem;
}

.ai-avatar {
  width: 0.8rem;
  height: 0.8rem;
  position: relative;
}

.ai-avatar-inner {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #ff6b6b, #4ecdc4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0.04rem 0.16rem rgba(0, 0, 0, 0.2);
  position: relative;
  overflow: hidden;
}

.ai-avatar-inner::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: shimmer 3s infinite;
}

@keyframes shimmer {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.ai-icon {
  font-size: 0.32rem;
  z-index: 1;
  position: relative;
}

.ai-info {
  flex: 1;
}

.ai-title {
  color: white;
  font-size: 0.28rem;
  font-weight: 600;
  margin: 0 0 0.08rem 0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.ai-status {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.2rem;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.12rem;
}

.status-dot {
  width: 0.12rem;
  height: 0.12rem;
  background: #4ade80;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

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

.ai-minimize-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 0.12rem;
  width: 0.48rem;
  height: 0.48rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.ai-minimize-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

.minimize-icon {
  color: white;
  font-size: 0.24rem;
  font-weight: bold;
}

/* 内容区域 */
.ai-chat-content {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  transition: all 0.3s ease;
}

.ai-chat-content.minimized {
  max-height: 0;
  overflow: hidden;
}

/* 欢迎消息 */
.ai-welcome-message {
  padding: 0.4rem 0.32rem;
  text-align: center;
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
  position: relative;
}

.ai-welcome-message::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
}

.welcome-icon {
  font-size: 0.48rem;
  margin-bottom: 0.16rem;
}

.ai-welcome-message h4 {
  margin: 0 0 0.16rem 0;
  font-size: 0.28rem;
  font-weight: 600;
}

.ai-welcome-message p {
  margin: 0;
  font-size: 0.22rem;
  opacity: 0.9;
  line-height: 1.4;
}

/* 快速建议 */
.ai-quick-suggestions {
  padding: 0.32rem;
  background: rgba(248, 250, 252, 0.8);
  border-bottom: 1px solid rgba(226, 232, 240, 0.5);
}

.suggestions-title {
  font-size: 0.24rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 0.24rem;
  display: flex;
  align-items: center;
  gap: 0.12rem;
}

.suggestion-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(4rem, 1fr));
  gap: 0.16rem;
}

.suggestion-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 0.24rem;
  padding: 0.16rem 0.2rem;
  font-size: 0.2rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 0.04rem 0.12rem rgba(102, 126, 234, 0.3);
  position: relative;
  overflow: hidden;
}

.suggestion-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s ease;
}

.suggestion-btn:hover::before {
  left: 100%;
}

.suggestion-btn:hover {
  transform: translateY(-0.04rem);
  box-shadow: 0 0.08rem 0.24rem rgba(102, 126, 234, 0.4);
}

.suggestion-btn:active {
  transform: translateY(0);
}

/* 消息容器 */
.ai-messages-container {
  max-height: 6rem;
  overflow-y: auto;
  padding: 0.24rem 0.32rem;
  background: white;
}

.ai-messages-container::-webkit-scrollbar {
  width: 0.08rem;
}

.ai-messages-container::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 0.04rem;
}

.ai-messages-container::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 0.04rem;
}

/* 消息样式 */
.message-item {
  margin-bottom: 0.24rem;
  animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(0.2rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-user {
  text-align: right;
}

.message-bubble {
  display: inline-block;
  max-width: 80%;
  padding: 0.2rem 0.24rem;
  border-radius: 0.24rem;
  font-size: 0.22rem;
  line-height: 1.4;
  word-wrap: break-word;
  position: relative;
}

.message-bubble.user {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-bottom-right-radius: 0.08rem;
}

.message-bubble.ai {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  color: #1e293b;
  border-bottom-left-radius: 0.08rem;
}

.message-timestamp {
  font-size: 0.18rem;
  color: #64748b;
  margin-top: 0.08rem;
}

/* 输入区域 */
.ai-input-section {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid rgba(226, 232, 240, 0.5);
}

.ai-input-wrapper {
  padding: 0.24rem;
  display: flex;
  gap: 0.16rem;
  align-items: flex-end;
}

.ai-input-field {
  flex: 1;
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 0.32rem;
  padding: 0.2rem 0.24rem;
  font-size: 0.22rem;
  resize: none;
  outline: none;
  transition: all 0.3s ease;
  max-height: 2rem;
  min-height: 0.8rem;
  line-height: 1.4;
}

.ai-input-field:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 0.06rem rgba(102, 126, 234, 0.1);
}

.ai-input-field::placeholder {
  color: #94a3b8;
}

.ai-send-button {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 50%;
  width: 0.8rem;
  height: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 0.04rem 0.16rem rgba(102, 126, 234, 0.3);
  flex-shrink: 0;
}

.ai-send-button:hover {
  transform: scale(1.05);
  box-shadow: 0 0.08rem 0.24rem rgba(102, 126, 234, 0.4);
}

.ai-send-button:active {
  transform: scale(0.95);
}

.ai-send-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.send-icon {
  width: 0.32rem;
  height: 0.32rem;
}

.ai-input-footer {
  padding: 0.16rem 0.24rem;
  text-align: center;
  border-top: 1px solid rgba(226, 232, 240, 0.3);
}

.powered-by {
  font-size: 0.18rem;
  color: #64748b;
}

/* 加载动画 */
.loading-message {
  display: flex;
  align-items: center;
  gap: 0.16rem;
  padding: 0.2rem 0.24rem;
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  border-radius: 0.24rem;
  border-bottom-left-radius: 0.08rem;
  max-width: 80%;
}

.loading-dots {
  display: flex;
  gap: 0.08rem;
}

.loading-dot {
  width: 0.12rem;
  height: 0.12rem;
  background: #667eea;
  border-radius: 50%;
  animation: loadingDots 1.4s infinite ease-in-out both;
}

.loading-dot:nth-child(1) { animation-delay: -0.32s; }
.loading-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes loadingDots {
  0%, 80%, 100% {
    transform: scale(0);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* PC端适配 */
@media screen and (min-width: 769px) {
  .ai-assistant-section {
    max-width: 20rem;
    margin: 0.4rem auto;
  }
  
  .ai-title {
    font-size: 0.32rem;
  }
  
  .ai-status {
    font-size: 0.22rem;
  }
  
  .suggestion-buttons {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .suggestion-btn {
    font-size: 0.22rem;
    padding: 0.2rem 0.24rem;
  }
  
  .ai-input-field {
    font-size: 0.24rem;
    padding: 0.24rem 0.28rem;
  }
  
  .message-bubble {
    font-size: 0.24rem;
  }
  
  .ai-messages-container {
    max-height: 8rem;
  }
}

/* 大屏幕优化 */
@media screen and (min-width: 1200px) {
  .ai-assistant-section {
    max-width: 24rem;
  }
  
  .suggestion-buttons {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.2rem;
  }
  
  .ai-messages-container {
    max-height: 10rem;
  }
}

/* 移动端专门优化 */
@media screen and (max-width: 768px) {
  .ai-assistant-section {
    margin: 0.4rem 0.2rem;
    padding: 0;
  }

  .ai-assistant-container {
    border-radius: 0.4rem;
    box-shadow: 0 0.1rem 1rem rgba(102, 126, 234, 0.2);
  }

  .ai-assistant-header {
    padding: 0.24rem 0.28rem;
  }

  .ai-avatar {
    width: 0.64rem;
    height: 0.64rem;
  }

  .ai-icon {
    font-size: 0.28rem;
  }

  .ai-title {
    font-size: 0.24rem;
    line-height: 1.3;
  }

  .ai-status {
    font-size: 0.18rem;
  }

  .ai-minimize-btn {
    width: 0.4rem;
    height: 0.4rem;
  }

  .minimize-icon {
    font-size: 0.2rem;
  }

  /* 欢迎消息移动端优化 */
  .ai-welcome-message {
    padding: 0.3rem 0.28rem;
  }

  .welcome-icon {
    font-size: 0.4rem;
    margin-bottom: 0.12rem;
  }

  .ai-welcome-message h4 {
    font-size: 0.24rem;
    margin-bottom: 0.12rem;
    line-height: 1.3;
  }

  .ai-welcome-message p {
    font-size: 0.2rem;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  /* 快速建议移动端优化 */
  .ai-quick-suggestions {
    padding: 0.24rem 0.28rem;
  }

  .suggestions-title {
    font-size: 0.22rem;
    margin-bottom: 0.2rem;
  }

  .suggestion-buttons {
    grid-template-columns: repeat(auto-fit, minmax(3.5rem, 1fr));
    gap: 0.12rem;
  }

  .suggestion-btn {
    padding: 0.14rem 0.16rem;
    font-size: 0.18rem;
    border-radius: 0.2rem;
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
    text-align: center;
    min-height: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* 输入区域移动端优化 */
  .ai-input-section {
    padding: 0.24rem 0.28rem;
  }

  .ai-input-field {
    font-size: 0.28rem;
    padding: 0.24rem;
    border-radius: 0.3rem;
    line-height: 1.4;
    min-height: 1.2rem;
    resize: none;
  }

  .ai-send-button {
    width: 0.8rem;
    height: 0.8rem;
    border-radius: 0.2rem;
  }

  .send-icon {
    width: 0.32rem;
    height: 0.32rem;
  }

  .ai-input-footer {
    padding-top: 0.16rem;
  }

  .powered-by {
    font-size: 0.18rem;
  }

  /* 消息容器移动端优化 */
  .ai-messages-container {
    max-height: 4rem;
    padding: 0.24rem 0.28rem;
  }

  .message-bubble {
    font-size: 0.24rem;
    padding: 0.2rem 0.24rem;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
  }

  .message-timestamp {
    font-size: 0.16rem;
    margin-top: 0.08rem;
  }

  /* 错误和成功消息 */
  .error-message,
  .success-message {
    font-size: 0.22rem;
    padding: 0.2rem 0.24rem;
    margin: 0.16rem 0.28rem;
    border-radius: 0.2rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
}

/* 极小屏幕设备优化 */
@media screen and (max-width: 360px) {
  .ai-assistant-section {
    margin: 0.3rem 0.15rem;
  }

  .ai-assistant-header {
    padding: 0.2rem 0.24rem;
  }

  .ai-avatar {
    width: 0.56rem;
    height: 0.56rem;
  }

  .ai-title {
    font-size: 0.22rem;
  }

  .ai-status {
    font-size: 0.16rem;
  }

  .suggestion-buttons {
    grid-template-columns: repeat(auto-fit, minmax(3rem, 1fr));
    gap: 0.1rem;
  }

  .suggestion-btn {
    font-size: 0.16rem;
    padding: 0.12rem 0.14rem;
    min-height: 0.7rem;
  }

  .ai-input-field {
    font-size: 0.26rem;
    padding: 0.2rem;
  }

  .message-bubble {
    font-size: 0.22rem;
    padding: 0.18rem 0.2rem;
  }
}

/* 错误状态 */
.error-message {
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  color: #dc2626;
  padding: 0.2rem 0.24rem;
  border-radius: 0.24rem;
  border-bottom-left-radius: 0.08rem;
  max-width: 80%;
  border: 1px solid #f87171;
}

/* 成功状态 */
.success-message {
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
  color: #16a34a;
  padding: 0.2rem 0.24rem;
  border-radius: 0.24rem;
  border-bottom-left-radius: 0.08rem;
  max-width: 80%;
  border: 1px solid #4ade80;
} 