/* 全局样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Updated color scheme to match design inspiration */
  --primary-color: #4ade80;
  --primary-hover: #22c55e;
  --secondary-color: #a3e635;
  --accent-color: #fbbf24;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --background-overlay: rgba(20, 30, 20, 0.25);
  --chat-background: rgba(255, 255, 255, 0.98);
  --message-ai: #f0fdf4;
  --message-user: #4ade80;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --border-radius: 16px;
  --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.12);
  --transition-smooth: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    sans-serif;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  position: relative;
}

/* 背景容器 */
.background-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  overflow: hidden;
}

.background-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition-smooth);
}

.background-container::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--background-overlay);
}

/* 悬浮动物 */
/* Updated floating animal position to center-right */
.floating-animal {
  position: fixed;
  /* Adjusted position to be more centered with better visibility */
  bottom: 20%;
  right: 30%;
  z-index: 10;
  animation: float 4s ease-in-out infinite;
  cursor: pointer;
  transition: var(--transition-smooth);
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.15));
}

.floating-animal:hover {
  transform: scale(1.08);
  filter: drop-shadow(0 12px 32px rgba(0, 0, 0, 0.2));
}

.floating-animal img {
  /* Increased size for better visibility */
  width: 280px;
  height: 280px;
  object-fit: contain;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-25px) rotate(2deg);
  }
}

/* 麦克风按钮 */
/* Enhanced mic button with nature-inspired green theme */
.mic-button {
  position: fixed;
  top: 30px;
  right: 30px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
  border: 3px solid var(--primary-color);
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mic-button:hover {
  transform: scale(1.12) rotate(5deg);
  box-shadow: 0 15px 50px rgba(74, 222, 128, 0.3);
  border-color: var(--primary-hover);
}

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

.mic-icon,
.mic-off-icon {
  width: 30px;
  height: 30px;
  color: var(--primary-color);
  transition: var(--transition-smooth);
}

.mic-off-icon {
  display: none;
  color: var(--danger-color);
}

.mic-button.active {
  background: var(--danger-color);
}

.mic-button.active .mic-icon {
  display: none;
}

.mic-button.active .mic-off-icon {
  display: block;
  color: white;
}

.mic-button.recording {
  animation: pulse 1.5s ease-in-out infinite;
  background: var(--danger-color);
  border-color: var(--danger-color);
}

/* Add styles for recording icon visibility */
.mic-button.recording .mic-icon {
  display: none;
}

.mic-button.recording .mic-off-icon {
  display: block;
  color: white;
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  }
  50% {
    box-shadow: 0 0 0 20px rgba(239, 68, 68, 0);
  }
}

/* 聊天容器 */
/* Enhanced chat container with modern glass morphism */
.chat-container {
  position: fixed;
  /* Changed initial position to be visible at bottom by default */
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 900px;
  height: 300px;
  background: var(--chat-background);
  backdrop-filter: blur(20px) saturate(180%);
  border-radius: var(--border-radius) var(--border-radius) 0 0;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(74, 222, 128, 0.2);
  z-index: 999;
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Removed the .active class requirement - chat is always visible */
/* Chat is now always visible at the bottom */

.chat-header {
  padding: 24px;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 12px rgba(74, 222, 128, 0.2);
}

.chat-header h2 {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.close-button {
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.close-button:hover {
  background: rgba(255, 255, 255, 0.3);
}

.close-button svg {
  width: 18px;
  height: 18px;
  color: white;
}

/* 聊天消息 */
.chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

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

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

.chat-messages::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

.message {
  display: flex;
  flex-direction: column;
  gap: 5px;
  animation: slideIn 0.3s ease-out;
}

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

.message-content {
  padding: 12px 16px;
  border-radius: 12px;
  max-width: 80%;
  word-wrap: break-word;
  line-height: 1.5;
}

.ai-message .message-content {
  background: var(--message-ai);
  color: var(--text-primary);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(74, 222, 128, 0.15);
}

.user-message .message-content {
  background: var(--message-user);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 8px rgba(74, 222, 128, 0.25);
}

/* 输入容器 */
.chat-input-container {
  padding: 20px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 10px;
  background: white;
}

.chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 24px;
  font-size: 14px;
  outline: none;
  transition: var(--transition-smooth);
}

.chat-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.1);
}

.send-button {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
  box-shadow: 0 4px 12px rgba(74, 222, 128, 0.3);
}

.send-button:hover {
  background: linear-gradient(135deg, var(--primary-hover) 0%, var(--primary-color) 100%);
  transform: scale(1.08) rotate(15deg);
  box-shadow: 0 6px 16px rgba(74, 222, 128, 0.4);
}

.send-button svg {
  width: 20px;
  height: 20px;
  color: white;
}

/* Removed all admin panel related styles (.admin-panel, .admin-toggle, .admin-content, .admin-section) */

/* 状态指示器 */
.status-indicator {
  position: fixed;
  top: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  padding: 10px 20px;
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition-smooth);
}

.status-indicator.active {
  opacity: 1;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success-color);
  animation: blink 1.5s ease-in-out infinite;
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

.status-text {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
}

/* 移动端响应式 */
@media (max-width: 768px) {
  .mic-button {
    top: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
  }

  .mic-icon,
  .mic-off-icon {
    width: 24px;
    height: 24px;
  }

  /* Full width chat on mobile */
  .chat-container {
    width: 100%;
    max-width: 100%;
    /* Increased height on mobile for better usability */
    height: 50vh;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
  }

  /* Adjusted floating animal position for mobile */
  .floating-animal {
    /* Better positioning for mobile devices */
    bottom: 55%;
    right: 50%;
    transform: translateX(50%);
  }

  .floating-animal img {
    width: 160px;
    height: 160px;
  }

  .admin-panel {
    bottom: 20px;
    left: 20px;
  }

  .admin-toggle {
    width: 45px;
    height: 45px;
  }

  .admin-content {
    width: calc(100vw - 40px);
    left: 50%;
    transform: translateX(-50%) translateY(10px);
  }

  .admin-content.active {
    transform: translateX(-50%) translateY(0);
  }

  .status-indicator {
    top: 20px;
    padding: 8px 16px;
  }
}

@media (max-width: 480px) {
  .floating-animal {
    bottom: 55%;
    right: 50%;
    transform: translateX(50%);
  }

  .floating-animal img {
    width: 120px;
    height: 120px;
  }

  .chat-header {
    padding: 15px;
  }

  .chat-header h2 {
    font-size: 16px;
  }

  .chat-messages {
    padding: 15px;
  }

  .chat-input-container {
    padding: 15px;
  }

  .message-content {
    font-size: 14px;
    max-width: 85%;
  }
}
