/* JitMind AI 知识库 - 公共样式文件 */
/* 基于 DESIGN_GUIDE.md 设计规范 */

/* ==================== 基础变量 ==================== */
:root {
  /* 品牌色彩 */
  --brand-blue: #165DFF;
  --brand-blue-dark: #044AE9;
  --brand-gradient: linear-gradient(135deg, #165DFF 0%, #044AE9 100%);
  
  /* 辅助色 */
  --accent-orange: #FF6B6B;
  --accent-orange-light: #FF8E53;
  --success-green: #10B981;
  --success-green-light: #34D399;
  --feature-purple: #8B5CF6;
  --feature-purple-light: #A78BFA;
  --vibrant-cyan: #00C9A7;
  --vibrant-cyan-light: #00E5B8;
  
  /* 中性色 */
  --text-primary: #151515;
  --text-secondary: #6C6F7D;
  --border-color: #E8ECFF;
  --bg-gray: #F8FAFF;
  --bg-gray-light: #F0F5FF;
  --white: #FFFFFF;
  
  /* 阴影 */
  --shadow-card: 0 4px 16px rgba(22, 93, 255, 0.08);
  --shadow-card-hover: 0 12px 32px rgba(22, 93, 255, 0.15);
  --shadow-dropdown: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-button: 0 4px 12px rgba(22, 93, 255, 0.3);
  
  /* 圆角 */
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 6px;
  --radius-full: 9999px;
  
  /* 过渡 */
  --transition-standard: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.2s ease-out;
  --transition-button: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==================== 基础重置 ==================== */
* {
  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;
  color: var(--text-primary);
  background-color: var(--bg-gray);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==================== 字体层级 ==================== */
.text-h1 {
  font-size: 48px;
  font-weight: 600;
  line-height: 1.4;
}

.text-h2 {
  font-size: 32px;
  font-weight: 600;
  line-height: 1.4;
}

.text-h3 {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.4;
}

.text-body {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
}

.text-small {
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
}

/* ==================== 按钮样式 ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-button);
  border: none;
  outline: none;
}

.btn-primary {
  background: var(--brand-blue);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--brand-blue-dark);
  box-shadow: var(--shadow-button);
}

.btn-gradient {
  background: var(--brand-gradient);
  color: var(--white);
}

.btn-gradient:hover {
  box-shadow: var(--shadow-button);
}

.btn-secondary {
  background: var(--white);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  border-color: var(--brand-blue);
  color: var(--brand-blue);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  color: var(--brand-blue);
  background: var(--bg-gray-light);
}

/* ==================== 卡片样式 ==================== */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
  transition: var(--transition-standard);
  overflow: hidden;
}

.card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-4px);
}

.card-static {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

/* ==================== 输入框样式 ==================== */
.input {
  width: 100%;
  padding: 12px 16px;
  font-size: 14px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--white);
  transition: var(--transition-fast);
  outline: none;
}

.input:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 4px rgba(22, 93, 255, 0.1);
}

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

/* ==================== 标签样式 ==================== */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-full);
  background: var(--white);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  transition: var(--transition-fast);
}

.tag:hover {
  border-color: var(--brand-blue);
  color: var(--brand-blue);
}

.tag-active {
  background: var(--brand-gradient);
  color: var(--white);
  border: none;
}

.tag-success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success-green);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.tag-warning {
  background: rgba(255, 107, 107, 0.1);
  color: var(--accent-orange);
  border: 1px solid rgba(255, 107, 107, 0.2);
}

/* ==================== 导航样式 ==================== */
.nav-link {
  color: var(--text-primary);
  font-weight: 500;
  text-decoration: none;
  transition: var(--transition-fast);
}

.nav-link:hover {
  color: var(--brand-blue);
}

.nav-link.active {
  color: var(--brand-blue);
}

/* ==================== 侧边栏样式 ==================== */
.sidebar {
  width: 240px;
  height: 100vh;
  background: var(--white);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-scroll::-webkit-scrollbar {
  width: 4px;
}

.sidebar-scroll::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 2px;
}

.sidebar-menu {
  list-style: none;
  padding: 16px 12px;
}

.sidebar-item {
  margin-bottom: 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
  font-size: 14px;
  font-weight: 500;
}

.sidebar-link:hover {
  background: var(--bg-gray-light);
  color: var(--brand-blue);
}

.sidebar-link.active {
  background: var(--bg-gray-light);
  color: var(--brand-blue);
}

.sidebar-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* ==================== 表格样式 ==================== */
.table-container {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th {
  text-align: left;
  padding: 12px 16px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-gray);
}

.table td {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
}

.table tr:hover td {
  background: var(--bg-gray-light);
}

/* ==================== 下拉菜单样式 ==================== */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 200px;
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-dropdown);
  border: 1px solid var(--border-color);
  padding: 8px;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: var(--transition-standard);
}

.dropdown:hover .dropdown-menu,
.dropdown.active .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  color: var(--text-primary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
  font-size: 14px;
}

.dropdown-item:hover {
  background: var(--bg-gray-light);
}

/* ==================== 模态框样式 ==================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-standard);
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 32px 40px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-standard);
  min-width: 400px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
}

.modal.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

/* ==================== 动画 ==================== */
@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-20px); }
}

@keyframes gradient {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideIn {
  from { transform: translateX(-20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.animate-float {
  animation: float 6s ease-in-out infinite;
}

.animate-gradient {
  background-size: 200% 200%;
  animation: gradient 15s ease infinite;
}

.animate-fade-in {
  animation: fadeIn 0.3s ease-out;
}

.animate-slide-in {
  animation: slideIn 0.3s ease-out;
}

/* ==================== 工具类 ==================== */
.text-gradient {
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.divider {
  height: 1px;
  background: var(--border-color);
  margin: 16px 0;
}

/* ==================== 布局容器 ==================== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.main-layout {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  margin-left: 240px;
  width: calc(100vw - 240px);
}

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    position: fixed;
    bottom: 0;
    left: 0;
    height: auto;
    border-right: none;
    border-top: 1px solid var(--border-color);
    z-index: 100;
  }
  
  .sidebar-menu {
    display: flex;
    justify-content: space-around;
    padding: 8px;
  }
  
  .sidebar-item {
    margin: 0;
  }
  
  .sidebar-link {
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    font-size: 12px;
  }
  
  .sidebar-icon {
    width: 24px;
    height: 24px;
  }
  
  .main-content {
    padding: 16px;
    padding-bottom: 80px;
  }
}
