/* === AI绿植助手 - 样式表 === */

:root {
  --green-50: #f0fdf4;
  --green-100: #dcfce7;
  --green-200: #bbf7d0;
  --green-300: #86efac;
  --green-400: #4ade80;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --green-700: #15803d;
  --green-800: #166534;
  --green-900: #14532d;

  --bg-primary: #f7faf7;
  --bg-secondary: #edf5ee;
  --bg-white: #ffffff;
  --text-primary: #1a2e1a;
  --text-secondary: #4a5f4a;
  --text-muted: #8a9f8a;
  --border-color: #d4e4d4;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --sidebar-width: 320px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
}

/* === App Container === */
.app-container {
  display: flex;
  height: 100vh;
  max-width: 1200px;
  margin: 0 auto;
}

/* === Sidebar === */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-white);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform 0.3s ease, margin-left 0.3s ease;
  z-index: 10;
}

.sidebar.collapsed {
  margin-left: calc(-1 * var(--sidebar-width));
}

.sidebar-header {
  padding: 24px 20px 16px;
  text-align: center;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-header .logo {
  font-size: 48px;
  margin-bottom: 8px;
}

.sidebar-header h1 {
  font-size: 20px;
  color: var(--green-800);
  margin-bottom: 4px;
}

.sidebar-header p {
  font-size: 13px;
  color: var(--text-muted);
}

.sidebar-section {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-section h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* Category list */
.category-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.category-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s ease;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-size: 14px;
  color: var(--text-primary);
}

.category-item:hover {
  background: var(--green-50);
}

.category-item.active {
  background: var(--green-100);
  color: var(--green-800);
  font-weight: 500;
}

.category-item .cat-icon {
  font-size: 20px;
  width: 28px;
  text-align: center;
}

.category-item .cat-info {
  display: flex;
  flex-direction: column;
}

.category-item .cat-name {
  font-size: 14px;
}

.category-item .cat-desc {
  font-size: 11px;
  color: var(--text-muted);
}

/* Tips list */
.tips-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tip-card {
  background: var(--green-50);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  border-left: 3px solid var(--green-400);
}

.tip-card .tip-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--green-800);
  margin-bottom: 4px;
}

.tip-card .tip-content {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.sidebar-footer {
  padding: 16px 20px;
  margin-top: auto;
}

.btn-new-chat {
  width: 100%;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 2px dashed var(--green-300);
  background: var(--green-50);
  color: var(--green-700);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.btn-new-chat:hover {
  background: var(--green-100);
  border-color: var(--green-400);
}

/* === Chat Area === */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

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

.btn-toggle-sidebar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
  color: var(--text-secondary);
}

.btn-toggle-sidebar:hover {
  background: var(--bg-secondary);
}

/* Hamburger menu icon */
.icon-menu,
.icon-menu::before,
.icon-menu::after {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  position: relative;
}

.icon-menu::before {
  content: '';
  position: absolute;
  top: -5px;
}

.icon-menu::after {
  content: '';
  position: absolute;
  top: 5px;
}

.header-info h2 {
  font-size: 16px;
  color: var(--text-primary);
}

.header-info .status {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.status.online::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green-500);
}

/* === Messages Container === */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

.messages-container::-webkit-scrollbar-thumb {
  background: var(--green-200);
  border-radius: 3px;
}

/* Welcome Screen */
.welcome-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  flex: 1;
}

.welcome-screen .welcome-icon {
  font-size: 64px;
  margin-bottom: 16px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.welcome-screen h2 {
  font-size: 22px;
  color: var(--green-800);
  margin-bottom: 8px;
}

.welcome-screen p {
  font-size: 15px;
  color: var(--text-secondary);
  max-width: 420px;
  line-height: 1.6;
  margin-bottom: 24px;
}

.quick-questions {
  width: 100%;
  max-width: 480px;
}

.quick-title {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.quick-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.quick-btn {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--green-200);
  background: var(--bg-white);
  color: var(--green-700);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.quick-btn:hover {
  background: var(--green-50);
  border-color: var(--green-400);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* Messages List */
.messages-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message {
  display: flex;
  gap: 10px;
  max-width: 80%;
  animation: messageIn 0.3s ease;
}

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

.message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message.assistant {
  align-self: flex-start;
}

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.message.user .message-avatar {
  background: var(--green-100);
}

.message.assistant .message-avatar {
  background: var(--green-50);
}

.message-bubble {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  line-height: 1.6;
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}

.message.user .message-bubble {
  background: var(--green-500);
  color: white;
  border-bottom-right-radius: 4px;
}

.message.assistant .message-bubble {
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-sm);
}

.message-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  padding: 0 4px;
}

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

/* === Typing Indicator === */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  border-bottom-left-radius: 4px;
  width: fit-content;
  align-self: flex-start;
  margin-left: 46px;
  box-shadow: var(--shadow-sm);
}

.typing-indicator.hidden {
  display: none;
}

.typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green-300);
  animation: typingDot 1.4s infinite;
}

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

@keyframes typingDot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* === Chat Input Area === */
.chat-input-area {
  padding: 16px 20px;
  background: var(--bg-white);
  border-top: 1px solid var(--border-color);
}

.input-wrapper {
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 4px 4px 4px 16px;
  border: 2px solid transparent;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-wrapper:focus-within {
  border-color: var(--green-400);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
  background: var(--bg-white);
}

.chat-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px 0;
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
  min-width: 0;
}

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

.btn-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--green-500);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.btn-send:hover {
  background: var(--green-600);
  transform: scale(1.05);
}

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

.btn-send:disabled {
  background: var(--green-200);
  cursor: not-allowed;
  transform: none;
}

.input-hint {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 8px;
}

/* === Responsive === */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    box-shadow: var(--shadow-lg);
  }

  .sidebar.collapsed {
    transform: translateX(-100%);
    margin-left: 0;
  }

  .message {
    max-width: 90%;
  }

  .welcome-screen {
    padding: 24px 12px;
  }

  .welcome-screen .welcome-icon {
    font-size: 48px;
  }

  .welcome-screen h2 {
    font-size: 18px;
  }

  .quick-btn {
    font-size: 12px;
    padding: 6px 12px;
  }
}
