/* 自定义样式 - 基于 Pico CSS */

:root {
  --brand-color: #1a56db;
  --brand-hover: #1648c0;
  --status-green: #059669;
  --status-red: #dc2626;
  --status-yellow: #d97706;
  --status-blue: #2563eb;
  --bg-light: #f8fafc;
  --sidebar-width: 220px;
}

/* 全局 */
body {
  background: var(--bg-light);
  min-height: 100vh;
}

/* 登录页 */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1a56db 0%, #7c3aed 100%);
}

.login-card {
  background: white;
  padding: 2.5rem;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  width: 100%;
  max-width: 400px;
}

.login-card h1 {
  text-align: center;
  margin-bottom: 0.5rem;
  color: #1e293b;
}

.login-card .subtitle {
  text-align: center;
  color: #64748b;
  margin-bottom: 2rem;
  font-size: 0.9rem;
}

/* 布局 */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: white;
  border-right: 1px solid #e2e8f0;
  padding: 1.5rem 0;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}

.sidebar .logo {
  padding: 0 1.2rem 1.5rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--brand-color);
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 0.5rem;
}

.sidebar .user-info {
  padding: 0.8rem 1.2rem;
  font-size: 0.85rem;
  color: #64748b;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 0.5rem;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1.2rem;
  color: #475569;
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}

.sidebar nav a:hover {
  background: #f1f5f9;
  color: var(--brand-color);
}

.sidebar nav a.active {
  background: #eff6ff;
  color: var(--brand-color);
  border-left-color: var(--brand-color);
  font-weight: 600;
}

.sidebar nav a .icon {
  font-size: 1.1rem;
  width: 1.5rem;
  text-align: center;
}

.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 2rem;
  min-height: 100vh;
}

.page-header {
  margin-bottom: 1.5rem;
}

.page-header h2 {
  margin: 0;
  color: #1e293b;
  font-size: 1.5rem;
}

.page-header .description {
  color: #64748b;
  margin-top: 0.25rem;
  font-size: 0.9rem;
}

/* 统计卡片 */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: white;
  border-radius: 8px;
  padding: 1.2rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  border: 1px solid #e2e8f0;
}

.stat-card .label {
  font-size: 0.8rem;
  color: #64748b;
  margin-bottom: 0.3rem;
}

.stat-card .value {
  font-size: 1.6rem;
  font-weight: 700;
  color: #1e293b;
}

.stat-card .value.green { color: var(--status-green); }
.stat-card .value.red { color: var(--status-red); }
.stat-card .value.blue { color: var(--status-blue); }
.stat-card .value.yellow { color: var(--status-yellow); }

/* 搜索和筛选栏 */
.filter-bar {
  display: flex;
  gap: 0.8rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.filter-bar input,
.filter-bar select {
  margin: 0;
  width: auto;
  min-width: 180px;
}

.filter-bar .btn-group {
  display: flex;
  gap: 0.3rem;
}

.filter-bar .btn-group button {
  margin: 0;
  font-size: 0.85rem;
  padding: 0.4rem 1rem;
}

/* 表格容器 */
.table-container {
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  border: 1px solid #e2e8f0;
  overflow: hidden;
}

.table-container table {
  margin: 0;
}

.table-container table th {
  background: #f8fafc;
  font-size: 0.8rem;
  text-transform: none;
  color: #64748b;
  padding: 0.7rem 0.8rem;
  white-space: nowrap;
}

.table-container table td {
  padding: 0.6rem 0.8rem;
  font-size: 0.88rem;
  vertical-align: middle;
}

.table-container table tr:hover {
  background: #f8fafc;
}

.table-container table tr.clickable {
  cursor: pointer;
}

.table-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  font-size: 0.85rem;
  color: #64748b;
}

/* 状态标签 */
.tag {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 600;
}

.tag-success { background: #ecfdf5; color: var(--status-green); }
.tag-danger { background: #fef2f2; color: var(--status-red); }
.tag-warning { background: #fffbeb; color: var(--status-yellow); }
.tag-info { background: #eff6ff; color: var(--status-blue); }
.tag-default { background: #f1f5f9; color: #64748b; }

/* 按钮补充 */
.btn-sm {
  padding: 0.3rem 0.8rem;
  font-size: 0.8rem;
}

/* 上传区域 */
.upload-zone {
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  padding: 3rem;
  text-align: center;
  background: white;
  cursor: pointer;
  transition: all 0.2s;
}

.upload-zone:hover {
  border-color: var(--brand-color);
  background: #f8fafc;
}

.upload-zone .icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.upload-zone p {
  color: #64748b;
  margin: 0;
}

/* 弹窗 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  border-radius: 12px;
  padding: 2rem;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.modal-content h3 {
  margin-top: 0;
  margin-bottom: 1rem;
}

.modal-actions {
  display: flex;
  gap: 0.8rem;
  margin-top: 1.5rem;
  justify-content: flex-end;
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 3rem;
  color: #94a3b8;
}

.empty-state .icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

/* 跟进记录时间线 */
.timeline {
  position: relative;
  padding-left: 1.5rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0.5rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #e2e8f0;
}

.timeline-item {
  position: relative;
  padding-bottom: 1rem;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.2rem;
  top: 0.4rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand-color);
  border: 2px solid white;
}

.timeline-item .date {
  font-size: 0.78rem;
  color: #94a3b8;
}

.timeline-item .type {
  font-size: 0.82rem;
  font-weight: 600;
  color: #1e293b;
}

/* 预览表格 */
.preview-section {
  margin-bottom: 1rem;
}

.preview-section h4 {
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.preview-table {
  max-height: 300px;
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
}

.preview-table table {
  margin: 0;
  font-size: 0.8rem;
}

.preview-table table th {
  position: sticky;
  top: 0;
  z-index: 1;
}

/* 响应式 */
@media (max-width: 768px) {
  .sidebar {
    width: 60px;
  }
  .sidebar .logo span,
  .sidebar nav a span {
    display: none;
  }
  .sidebar .user-info {
    display: none;
  }
  .main-content {
    margin-left: 60px;
    padding: 1rem;
  }
  .stat-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}
