/* 极奥法律 AI - 现代法律咨询站样式 */

:root {
  --primary: #1a3a5c;
  --primary-light: #2a5a8c;
  --accent: #c9a45c;
  --accent-hover: #b8954e;
  --bg: #f7f8fa;
  --card-bg: #ffffff;
  --text: #2c3e50;
  --text-light: #7f8c9b;
  --user-bubble: #1a3a5c;
  --ai-bubble: #eef2f7;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --radius: 12px;
}

* { 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);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 顶部导航 */
.top-nav {
  background: linear-gradient(135deg, #1a3a5c 0%, #2a5a8c 100%);
  color: #fff;
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

.nav-content {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.logo::before {
  content: "⚖️";
  margin-right: 8px;
}

.tagline {
  font-size: 0.9rem;
  opacity: 0.85;
  background: rgba(255,255,255,0.15);
  padding: 6px 14px;
  border-radius: 20px;
}

/* 主区域 */
.chat-main {
  flex: 1;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
  padding: 20px;
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.chat-container {
  flex: 1;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  display: flex;
  flex-direction: column;
  min-height: 70vh;
}

/* 欢迎卡片 */
.welcome-card {
  background: linear-gradient(135deg, #f0f4f9 0%, #faf6ee 100%);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  border-left: 4px solid var(--accent);
}

.welcome-card h1 {
  font-size: 1.3rem;
  color: var(--primary);
  margin-bottom: 12px;
}

.welcome-desc {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
}

.highlight {
  color: var(--accent);
  font-weight: 600;
}

.welcome-tip {
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--text-light);
  background: rgba(255,255,255,0.7);
  padding: 8px 12px;
  border-radius: 8px;
}

/* 消息区 */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 55vh;
}

.msg {
  display: flex;
  gap: 12px;
  max-width: 85%;
  animation: fadeIn 0.3s ease;
}

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

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

.msg.ai {
  align-self: flex-start;
}

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

.msg.user .msg-avatar {
  background: var(--primary);
  color: #fff;
}

.msg.ai .msg-avatar {
  background: var(--accent);
  color: #fff;
}

.msg-content {
  padding: 12px 16px;
  border-radius: var(--radius);
  line-height: 1.7;
  font-size: 0.95rem;
  word-break: break-word;
}

.msg.user .msg-content {
  background: var(--user-bubble);
  color: #fff;
  border-top-right-radius: 4px;
}

.msg.ai .msg-content {
  background: var(--ai-bubble);
  color: var(--text);
  border-top-left-radius: 4px;
}

.msg.ai .msg-content p { margin-bottom: 8px; }
.msg.ai .msg-content p:last-child { margin-bottom: 0; }
.msg.ai .msg-content strong { color: var(--primary); }

/* 输入区 */
.input-area {
  margin-top: 16px;
  border-top: 1px solid #e8ecf1;
  padding-top: 16px;
}

.input-wrapper {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  background: #fff;
  border: 1.5px solid #dfe5ec;
  border-radius: 24px;
  padding: 8px 8px 8px 16px;
  transition: border-color 0.2s;
}

.input-wrapper:focus-within {
  border-color: var(--primary-light);
}

#userInput {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  font-size: 0.95rem;
  font-family: inherit;
  padding: 6px 0;
  max-height: 120px;
  line-height: 1.5;
  background: transparent;
}

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

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

.send-btn:disabled {
  background: #c0c8d0;
  cursor: not-allowed;
  transform: none;
}

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

/* 打字指示器 */
.typing {
  display: flex;
  gap: 4px;
  padding: 4px 0;
}

.typing span {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: bounce 1.2s infinite;
}

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

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

/* 留资卡片 */
.lead-card {
  width: 280px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  position: sticky;
  top: 90px;
  border-top: 4px solid var(--accent);
  animation: fadeIn 0.4s ease;
}

.lead-card.hidden { display: none; }

.lead-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.lead-icon { font-size: 1.2rem; }

.lead-header h3 {
  font-size: 1rem;
  color: var(--primary);
}

.lead-desc {
  font-size: 0.85rem;
  color: var(--text-light);
  line-height: 1.6;
  margin-bottom: 14px;
}

.lead-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lead-form input,
.lead-form textarea {
  border: 1.5px solid #dfe5ec;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  background: #fff;
}

.lead-form input:focus,
.lead-form textarea:focus {
  border-color: var(--primary-light);
}

.lead-form textarea {
  resize: vertical;
  min-height: 60px;
}

.submit-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.submit-btn:hover {
  background: var(--accent-hover);
}

/* 页脚 */
.footer {
  text-align: center;
  padding: 24px 20px;
  color: var(--text-light);
  font-size: 0.8rem;
  border-top: 1px solid #e8ecf1;
  background: #fff;
}

.footer-links {
  margin-top: 6px;
}

.footer-links a {
  color: var(--text-light);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--primary);
}

/* 响应式 */
@media (max-width: 768px) {
  .chat-main {
    flex-direction: column;
    padding: 10px;
  }
  .lead-card {
    width: 100%;
    position: static;
    margin-top: 16px;
  }
  .messages {
    max-height: 50vh;
  }
  .msg {
    max-width: 92%;
  }
}
