/* 钲鹏ERP - 现代增强主题 V5.0 */
/* 仪表盘看板、数据卡片、进度指标、智能通知等 */

/* ============ 增强CSS变量 ============ */
:root {
  --gradient-primary: linear-gradient(135deg, #4A90D9 0%, #72ABE3 100%);
  --gradient-success: linear-gradient(135deg, #10b981 0%, #34d399 100%);
  --gradient-warning: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
  --gradient-danger: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
  --gradient-info: linear-gradient(135deg, #5B9BD5 0%, #80B5E3 100%);
  --gradient-teal: linear-gradient(135deg, #06b6d4 0%, #22d3ee 100%);
  --gradient-dark: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  --radius-lg: 16px;
  --radius-xl: 20px;
  --glow-primary: 0 0 20px rgba(74,144,217,.25);
  --glow-success: 0 0 20px rgba(16,185,129,.25);
  --transition-bounce: cubic-bezier(.68,-.55,.265,1.55);
}

/* ============ 智能仪表盘数据卡片 ============ */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  padding: 4px;
}

.stat-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: all .3s var(--transition-bounce);
  border: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  transition: height .3s;
}
.stat-card.primary::before { background: var(--gradient-primary); }
.stat-card.success::before { background: var(--gradient-success); }
.stat-card.warning::before { background: var(--gradient-warning); }
.stat-card.danger::before { background: var(--gradient-danger); }
.stat-card.info::before { background: var(--gradient-info); }
.stat-card.teal::before { background: var(--gradient-teal); }

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,.1);
}
.stat-card:hover::before { height: 6px; }

.stat-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}
.stat-card.primary .stat-icon { background: var(--primary-bg); color: var(--primary); }
.stat-card.success .stat-icon { background: var(--success-light); color: var(--success); }
.stat-card.warning .stat-icon { background: var(--warning-light); color: var(--warning); }
.stat-card.danger .stat-icon { background: var(--danger-light); color: var(--danger); }
.stat-card.info .stat-icon { background: var(--info-light); color: var(--info); }
.stat-card.teal .stat-icon { background: var(--teal-light); color: var(--teal); }

.stat-content { flex: 1; min-width: 0; }
.stat-value {
  font-size: 32px; font-weight: 800;
  line-height: 1.1; color: var(--text);
  display: flex; align-items: baseline; gap: 6px;
}
.stat-unit { font-size: 14px; font-weight: 400; color: var(--text-light); }
.stat-label { font-size: 13px; color: var(--text-light); margin-top: 4px; }
.stat-sub {
  font-size: 12px; color: var(--text-muted); margin-top: 6px;
  display: flex; align-items: center; gap: 4px;
}
.stat-sub .up { color: var(--success); }
.stat-sub .down { color: var(--danger); }

/* 迷你图内嵌 */
.stat-sparkline {
  height: 36px; width: 80px; margin-top: 8px;
}

/* ============ 快捷操作区 ============ */
.quick-actions-bar {
  display: flex; gap: 12px; flex-wrap: wrap;
  padding: 16px 0;
}
.quick-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 20px;
  border-radius: 12px;
  border: none; cursor: pointer;
  font-size: 14px; font-weight: 600;
  color: #fff;
  transition: all .25s var(--transition-bounce);
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
}
.quick-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
}
.quick-btn:active { transform: translateY(0); }
.quick-btn .btn-icon { font-size: 18px; }

.quick-btn.workorder { background: var(--gradient-primary); }
.quick-btn.sales { background: var(--gradient-success); }
.quick-btn.aftersale { background: var(--gradient-warning); }
.quick-btn.purchase { background: var(--gradient-info); }
.quick-btn.expense { background: var(--gradient-danger); }
.quick-btn.quality { background: var(--gradient-teal); }
.quick-btn.attendance { background: var(--gradient-dark); }

/* ============ 进度指标条 ============ */
.progress-indicator {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: var(--bg);
  border-radius: 12px;
  margin-bottom: 8px;
}
.progress-indicator .pi-label {
  min-width: 70px; font-size: 13px; font-weight: 600;
  color: var(--text-secondary);
}
.progress-indicator .pi-bar {
  flex: 1; height: 10px;
  background: var(--border-light);
  border-radius: 5px; overflow: hidden;
}
.progress-indicator .pi-fill {
  height: 100%; border-radius: 5px;
  transition: width .6s var(--transition-bounce);
  background: var(--gradient-primary);
}
.progress-indicator .pi-value {
  min-width: 50px; text-align: right;
  font-size: 14px; font-weight: 700; color: var(--text);
}
.progress-indicator .pi-fill.success { background: var(--gradient-success); }
.progress-indicator .pi-fill.warning { background: var(--gradient-warning); }
.progress-indicator .pi-fill.danger { background: var(--gradient-danger); }
.progress-indicator .pi-fill.teal { background: var(--gradient-teal); }

/* ============ 状态标签增强 ============ */
.status-tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
}
.status-tag::before {
  content: ''; width: 7px; height: 7px;
  border-radius: 50%; flex-shrink: 0;
}
.status-tag.pending { background: var(--primary-bg); color: var(--primary); }
.status-tag.pending::before { background: var(--primary); }
.status-tag.active { background: #d1fae5; color: #059669; }
.status-tag.active::before { background: #10b981; }
.status-tag.warning { background: #fef3c7; color: #b45309; }
.status-tag.warning::before { background: #f59e0b; }
.status-tag.error { background: #fee2e2; color: #dc2626; }
.status-tag.error::before { background: #ef4444; }
.status-tag.info { background: var(--info-light); color: var(--primary-dark); }
.status-tag.info::before { background: var(--info); }
.status-tag.done { background: #f1f5f9; color: #475569; }
.status-tag.done::before { background: #94a3b8; }

/* ============ 数据表格增强 ============ */
.erp-table-container {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
}
.erp-table-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.erp-table-title { font-size: 16px; font-weight: 700; color: var(--text); }
.erp-table-actions { display: flex; gap: 8px; }
.erp-table {
  width: 100%; border-collapse: collapse;
}
.erp-table th {
  padding: 12px 14px; text-align: left;
  font-size: 12px; font-weight: 700; color: var(--text-light);
  text-transform: uppercase; letter-spacing: .5px;
  background: var(--bg); border-bottom: 2px solid var(--border);
  position: sticky; top: 0; z-index: 1;
}
.erp-table td {
  padding: 12px 14px; font-size: 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
}
.erp-table tbody tr { transition: background .15s; }
.erp-table tbody tr:hover { background: var(--bg-hover); }
.erp-table tbody tr.clickable { cursor: pointer; }

/* ============ 智能通知徽标 ============ */
.notification-badge {
  position: relative;
}
.notification-badge::after {
  content: attr(data-count);
  position: absolute; top: -6px; right: -6px;
  min-width: 18px; height: 18px;
  background: var(--danger);
  color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 5px;
  box-shadow: 0 2px 6px rgba(239,68,68,.4);
  animation: badge-pulse 2s infinite;
}
.notification-badge[data-count="0"]::after { display: none; }

@keyframes badge-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* ============ 智能搜索框增强 ============ */
.smart-search {
  position: relative;
  width: 360px;
}
.smart-search input {
  width: 100%; height: 40px;
  padding: 0 16px 0 42px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 14px; background: var(--bg);
  transition: all .25s;
  outline: none;
}
.smart-search input:focus {
  border-color: var(--primary);
  background: var(--bg-white);
  box-shadow: 0 0 0 3px rgba(74,144,217,.12);
}
.smart-search .search-icon {
  position: absolute; left: 14px; top: 50%;
  transform: translateY(-50%);
  font-size: 16px; color: var(--text-muted);
}
.smart-search .search-shortcut {
  position: absolute; right: 12px; top: 50%;
  transform: translateY(-50%);
  font-size: 11px; padding: 2px 7px;
  background: var(--border); border-radius: 4px;
  color: var(--text-muted);
}
.search-dropdown {
  position: absolute; top: 48px; left: 0; right: 0;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 40px rgba(0,0,0,.12);
  max-height: 400px; overflow-y: auto;
  z-index: 1000; display: none;
}
.search-dropdown.show { display: block; animation: dropdown-in .2s ease-out; }
.search-dropdown .search-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; cursor: pointer;
  transition: background .15s;
}
.search-dropdown .search-item:hover { background: var(--bg-hover); }
.search-dropdown .search-item .si-type {
  font-size: 11px; padding: 3px 8px;
  border-radius: 6px; font-weight: 600;
  background: var(--primary-bg); color: var(--primary);
}
.search-dropdown .search-item .si-title {
  font-size: 14px; font-weight: 600; color: var(--text);
  flex: 1;
}
.search-dropdown .search-item .si-sub {
  font-size: 12px; color: var(--text-muted);
}

@keyframes dropdown-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============ 消息 Toast 系统 ============ */
.toast-container {
  position: fixed; top: 80px; right: 24px;
  z-index: 10000; display: flex; flex-direction: column;
  gap: 10px;
}
.toast {
  padding: 14px 20px; border-radius: 12px;
  font-size: 14px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  display: flex; align-items: center; gap: 10px;
  min-width: 300px; max-width: 480px;
  animation: toast-slide .3s ease-out;
  backdrop-filter: blur(10px);
}
.toast.success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.toast.error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.toast.warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.toast.info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.toast-close { margin-left: auto; cursor: pointer; opacity: .5; font-size: 16px; }
.toast-close:hover { opacity: 1; }

@keyframes toast-slide {
  from { opacity: 0; transform: translateX(50px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ============ 模态框增强 ============ */
.erp-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(4px);
  z-index: 5000;
  display: flex; align-items: center; justify-content: center;
  animation: fade-in .2s;
}
.erp-modal {
  background: var(--bg-white);
  border-radius: var(--radius-xl);
  box-shadow: 0 24px 80px rgba(0,0,0,.2);
  max-width: 720px; width: 90%;
  max-height: 85vh; overflow-y: auto;
  animation: modal-in .3s var(--transition-bounce);
}
.erp-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.erp-modal-title { font-size: 18px; font-weight: 700; }
.erp-modal-close {
  width: 36px; height: 36px; border-radius: 10px;
  border: none; background: var(--bg);
  cursor: pointer; font-size: 18px; color: var(--text-light);
  transition: all .2s;
}
.erp-modal-close:hover { background: var(--danger-light); color: var(--danger); }
.erp-modal-body { padding: 24px; }
.erp-modal-footer {
  padding: 16px 24px; border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in {
  from { opacity: 0; transform: scale(.92) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ============ 表单增强 ============ */
.erp-form-group {
  margin-bottom: 18px;
}
.erp-form-label {
  display: block; font-size: 13px; font-weight: 700;
  color: var(--text-secondary); margin-bottom: 6px;
}
.erp-form-label .required { color: var(--danger); margin-left: 2px; }
.erp-form-input,
.erp-form-select,
.erp-form-textarea {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px; color: var(--text);
  background: var(--bg);
  transition: all .2s;
  outline: none;
  font-family: inherit;
}
.erp-form-input:focus,
.erp-form-select:focus,
.erp-form-textarea:focus {
  border-color: var(--primary);
  background: var(--bg-white);
  box-shadow: 0 0 0 3px rgba(74,144,217,.10);
}
.erp-form-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
.erp-form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.erp-btn {
  padding: 10px 22px; border-radius: 10px;
  border: none; cursor: pointer;
  font-size: 14px; font-weight: 600;
  transition: all .2s;
  display: inline-flex; align-items: center; gap: 6px;
}
.erp-btn-primary { background: var(--primary); color: #fff; }
.erp-btn-primary:hover { background: var(--primary-dark); box-shadow: var(--glow-primary); }
.erp-btn-success { background: var(--success); color: #fff; }
.erp-btn-success:hover { filter: brightness(1.1); box-shadow: var(--glow-success); }
.erp-btn-danger { background: var(--danger); color: #fff; }
.erp-btn-outline {
  background: transparent; color: var(--primary);
  border: 1.5px solid var(--primary);
}
.erp-btn-outline:hover { background: var(--primary-bg); }
.erp-btn-sm { padding: 6px 14px; font-size: 12px; border-radius: 8px; }
.erp-btn-lg { padding: 14px 28px; font-size: 16px; border-radius: 12px; }

/* ============ 空状态 ============ */
.empty-state {
  text-align: center; padding: 60px 20px;
}
.empty-state .empty-icon { font-size: 64px; margin-bottom: 16px; }
.empty-state .empty-title { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.empty-state .empty-desc { font-size: 14px; color: var(--text-muted); margin-bottom: 20px; }

/* ============ Tab导航增强 ============ */
.erp-tabs {
  display: flex; gap: 4px;
  background: var(--bg); padding: 4px;
  border-radius: 12px;
}
.erp-tab {
  padding: 8px 18px; border-radius: 10px;
  font-size: 14px; font-weight: 500;
  color: var(--text-light); cursor: pointer;
  border: none; background: transparent;
  transition: all .2s;
  white-space: nowrap;
}
.erp-tab:hover { color: var(--text); }
.erp-tab.active {
  background: var(--bg-white);
  color: var(--primary);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

/* ============ 实时时间线 ============ */
.timeline {
  padding: 8px 0;
}
.timeline-item {
  display: flex; gap: 14px; padding: 12px 0;
  position: relative;
}
.timeline-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--primary); flex-shrink: 0;
  margin-top: 5px;
  position: relative;
  z-index: 1;
}
.timeline-item:not(:last-child) .timeline-dot::after {
  content: '';
  position: absolute; top: 14px; left: 4px;
  width: 2px; height: calc(100% + 12px);
  background: var(--border);
}
.timeline-content {
  flex: 1; min-width: 0;
}
.timeline-title { font-size: 14px; font-weight: 600; color: var(--text); }
.timeline-time { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.timeline-desc { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* ============ 响应式兼容 ============ */
@media (max-width: 768px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .erp-form-row { grid-template-columns: 1fr; }
  .quick-actions-bar { justify-content: center; }
  .smart-search { width: 100%; }
  .quick-btn { padding: 8px 14px; font-size: 13px; }
  .stat-value { font-size: 24px; }
  .erp-modal { width: 95%; max-height: 90vh; }
}
