/* 
===============================================
鼎沛文化 - 项目管理系统 V1 样式表
===============================================
*/

/* ========== Vue初始化防闪烁 ========== */
/* 作用：隐藏未初始化的Vue模板，避免页面加载时闪烁 */
/* 原理：Vue初始化完成后会自动移除v-cloak属性 */
/* ========== 全局链接样式 ========== */
/* 作用：去除所有链接的默认下划线 */
a, a:hover, a:focus, a:active, a:visited {
  text-decoration: none !important;
}

[v-cloak] { display: none !important; }

/* ========== 全局变量 ========== */
:root {
  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --primary-light: #dbeafe;
  --success: #059669;
  --success-light: #d1fae5;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;
  
  --bg-body: #f3f4f6;
  --bg-white: #ffffff;
  --bg-sidebar: #f9fafb;
  --bg-sidebar-hover: #e5e7eb;
  
  --border: #e5e7eb;
  --border-light: #f3f4f6;
  
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
  --radius: 8px;
  --radius-sm: 6px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

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

.login-box {
  background: var(--bg-white);
  padding: 40px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 360px;
}

.login-header {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo {
  width: 48px; height: 48px;
  background: var(--primary);
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  color: white;
  font-weight: 700;
  font-size: 16px;
}

.login-header h1 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
}

.login-header p {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
}

/* ========== 表单 ========== */
.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: border-color 0.15s;
  background: var(--bg-white);
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.error-msg {
  color: var(--danger);
  font-size: 13px;
  margin-top: 10px;
  text-align: center;
}

/* ========== 按钮 ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  gap: 6px;
}

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

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

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; padding: 11px; }

/* ========== 布局 ========== */
.main-layout {
  display: flex;
  min-height: 100vh;
  overflow: hidden;
  height: 100vh;
}

/* ========== 侧边栏 ========== */
.sidebar {
  width: 150px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
}

.sidebar-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo-img {
  width: 40px;
  height: auto;
  vertical-align: middle;
  position: relative;
  top: -4px;
}

.sidebar-logo-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--primary);
  margin-left: 8px;
  vertical-align: middle;
}

.nav-menu {
  list-style: none;
  padding: 20px 0;
  flex: 1;
}

/* 菜单项间距统一 */
.nav-menu li {
  margin: 0;
}

/* 菜单链接样式 - 去除默认下划线 */
.nav-menu a,
.nav-link {
  display: block;
  padding: 10px 26px;
  color: var(--text-secondary);
  text-decoration: none !important;
  font-size: 14px;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}

.nav-link:hover,
.nav-menu a:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-primary);
  text-decoration: none !important;
}

.nav-link.active,
.nav-menu a.active {
  background: var(--primary-light);
  color: var(--primary);
  border-left-color: var(--primary);
  text-decoration: none !important;
}

.sidebar-footer {
  padding: 8px 0;
  border-top: 1px solid var(--border);
}

.sidebar-footer .nav-link {
  padding: 10px 26px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  display: block;
  text-decoration: none !important;
}

.sidebar-footer .nav-link:hover {
  text-decoration: none !important;
}

.menu-icon {
  font-size: 15px;
  margin-right: 8px;
  vertical-align: middle;
  position: relative;
  top: -2px;
}

.sidebar-toggle {
  display: none;
}

/* ========== 内容区 ========== */
.content {
  flex: 1;
  margin-left: 150px;
  padding: 20px;
  height: 100vh;
  overflow-y: auto;
}

/* ========== 页头 ========== */
.page-header {
  margin-bottom: 20px;
}

.page-header h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
}

.page-header p {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 2px;
}

/* ========== 统计卡片 ========== */
/* 作用：显示项目关键数据概览 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-white);
  padding: 14px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* 标题样式 - 缩小字体 */
.stat-card h3 {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 6px;
  text-align: center;
}

/* 数值样式 - 缩小字体 */
.stat-card .value {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
}

.stat-card .value.primary { color: var(--primary); }
.stat-card .value.success { color: var(--success); }
.stat-card .value.danger { color: var(--danger); }

/* 筛选按钮组 */
.filter-group { display:flex;align-items:center;gap:4px;flex-wrap:wrap }
.filter-btn { padding:4px 10px;border:1px solid #d1d5db;background:#fff;border-radius:4px;font-size:12px;cursor:pointer;color:#6b7280;transition:all .2s }
.filter-btn:hover { border-color:var(--primary);color:var(--primary) }
.filter-btn.active { background:var(--primary);border-color:var(--primary);color:#fff }

/* ========== 卡片 ========== */
.card {
  background: var(--bg-white);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}

.card-header {
  padding: 5px 16px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-header h3 {
  font-size: 14px;
  font-weight: 600;
}

.card-body { padding: 12px 16px; }

/* ========== 表格 ========== */
table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 14px 16px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

th {
  background: #f1f5f9;
  font-weight: 600;
  color: #334155;
  font-size: 14px;
  text-transform: none;
}

tbody tr {
  background: var(--bg-white);
  transition: background 0.15s;
}

tbody tr:hover {
  background: #f8fafc;
}

/* ========== 表格样式 ========== */
/* 作用：统一表格显示风格 */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }

/* 产品明细表格 - 字体紧凑 */
.product-table th,
.product-table td {
  padding: 6px 8px;
  font-size: 12px;
}

.product-table th {
  padding: 6px 8px;
  font-size: 12px;
}

/* 汇总行样式 - 用于产品明细合计 */
.summary-row {
  background: #f8fafc;
  border-top: 2px solid var(--primary);
  font-weight: 600;
}
.summary-row td {
  padding: 12px 16px;
}

/* 排序按钮样式 - 用于产品明细上下移动 */
.sort-buttons {
  display: inline-flex;
  flex-direction: column;
  gap: 0;
  line-height: 1;
}
.btn-sort-up, .btn-sort-down {
  width: 18px;
  height: 16px;
  border: none;
  background: transparent;
  color: #9ca3af;
  font-size: 10px;
  cursor: pointer;
  padding: 0;
  line-height: 16px;
  transition: color 0.15s;
}
.btn-sort-up:hover:not(:disabled), .btn-sort-down:hover:not(:disabled) {
  color: #3b82f6;
}
.btn-sort-up:disabled, .btn-sort-down:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ========== 状态标签 ========== */
.status-tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.status-tag.pending { background: var(--warning-light); color: #92400e; }
.status-tag.in-progress { background: var(--primary-light); color: #1e40af; }
.status-tag.completed { background: var(--success-light); color: #065f46; }
.status-tag.cancelled { background: var(--danger-light); color: #991b1b; }
.role-tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 500; }
.role-tag.admin { background: var(--primary-light); color: #1e40af; }
.role-tag.user { background: #f3f4f6; color: #6b7280; }
.status-tag.shipped { background: #f3e8ff; color: #6b21a8; }

/* ========== 发票状态 ========== */
.invoice-tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.invoice-tag.pending { background: var(--warning-light); color: #92400e; }
.invoice-tag.in-progress { background: var(--primary-light); color: #1e40af; }
.invoice-tag.completed { background: var(--success-light); color: #065f46; }

/* ========== 筛选栏 ========== */
.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.filter-bar input,
.filter-bar select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.filter-bar input:focus {
  outline: none;
  border-color: var(--primary);
}

/* ========== 项目汇总 ========== */
/* 项目汇总样式 - 每行4个，紧凑布局 */
.project-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}

/* 特殊情况：5列布局 */
.project-summary.five-cols {
  grid-template-columns: repeat(5, 1fr);
}
.summary-item.full-width {
  grid-column: 1 / -1;
}
.text-warning {
  color: #f59e0b;
}

.summary-item {
  background: #f9fafb;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

.summary-item label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 1px;
}

.summary-item .value {
  font-size: 13px;
  font-weight: 600;
}

/* ========== 跟进列表 ========== */
/* 作用：紧凑显示跟进事项 */
.followup-list { list-style: none; padding: 0; margin: 0; }

.followup-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border-light);
}

.followup-list li input[type="checkbox"] {
  width: 14px; height: 14px;
  accent-color: var(--primary);
}

.followup-list li .followup-content { flex: 1; font-size: 13px; }
.followup-list li.done .followup-content {
  text-decoration: line-through;
  color: var(--text-muted);
}

.followup-list li .delete-btn { opacity: 0; font-size: 11px; padding: 2px 6px; }
.followup-list li:hover .delete-btn { opacity: 1; }

.add-followup {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.add-followup input {
  flex: 1;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

/* ========== 模态框 ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: var(--bg-white);
  border-radius: var(--radius);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
}

.modal.wide { max-width: 720px; }

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 { font-size: 16px; font-weight: 600; }

.modal-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-body { padding: 20px; }

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: #f9fafb;
}

/* ========== Toast提示 ========== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1100;
}

.toast {
  background: var(--bg-white);
  padding: 12px 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  margin-bottom: 8px;
  border-left: 4px solid var(--success);
  font-size: 14px;
}

.toast.error { border-left-color: var(--danger); }

/* ========== 加载状态 ========== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ========== 空状态 ========== */
.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

/* ========== 返回链接 ========== */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  margin-bottom: 16px;
}

.back-link:hover { color: var(--primary); }

/* ========== 响应式 ========== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: block; }
  .content { margin-left: 0; padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .modal { width: 95%; }
  .filter-bar { flex-direction: column; }
}

@keyframes spin { to { transform: rotate(360deg); } }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
