/**
 * 启耀云工单管理系统 (QiYao WorkOrder Management System)
 * 版本: V1.0
 * 模块名称: 全局样式表
 * 作者: 杨伦
 * 创建日期: 2026-07-04
 * 版权所有 © 2026
 */

/* ============================================
   全局样式
   ============================================ */

/* ---------- CSS 变量 ---------- */
:root {
  --color-primary: #1976d2;
  --color-primary-dark: #1565c0;
  --color-success: #2e7d32;
  --color-warning: #f57c00;
  --color-danger: #d32f2f;
  --color-gray: #e0e0e0;
  --color-gray-dark: #9e9e9e;
  --color-text: #333;
  --color-text-light: #666;
  --color-bg: #f5f5f5;
  --color-white: #fff;
  --color-border: #ddd;
  --sidebar-width: 200px;
  --navbar-height: 56px;
  --radius: 6px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* ---------- 全局重置 ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.5;
}

a { text-decoration: none; color: inherit; }
ul, ol { list-style: none; }

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

.login-container {
  width: 100%;
  max-width: 400px;
  padding: 20px;
}

.login-card {
  background: var(--color-white);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  padding: 40px 36px;
}

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

.login-header h1 {
  font-size: 24px;
  color: var(--color-primary);
  margin-bottom: 6px;
}

.login-header p {
  font-size: 13px;
  color: var(--color-text-light);
}

.login-form .form-group {
  margin-bottom: 20px;
}

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

.login-form input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 14px;
  transition: border-color 0.2s;
}

.login-form input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.12);
}

.login-error {
  color: var(--color-danger);
  font-size: 13px;
  margin-bottom: 16px;
  text-align: center;
  padding: 8px;
  background: #ffebee;
  border-radius: var(--radius);
}

/* ---------- 顶部导航栏 ---------- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--navbar-height);
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.navbar-logo {
  font-size: 24px;
}

.navbar-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-primary);
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.navbar-user {
  font-size: 14px;
  color: var(--color-text-light);
}

/* ---------- 布局 ---------- */
.layout {
  display: flex;
  margin-top: var(--navbar-height);
  min-height: calc(100vh - var(--navbar-height));
}

/* ---------- 侧边栏 ---------- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--color-white);
  border-right: 1px solid var(--color-border);
  padding: 12px 0;
  flex-shrink: 0;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
  font-size: 14px;
  color: var(--color-text-light);
}

.nav-item:hover {
  background: #f0f7ff;
  color: var(--color-primary);
}

.nav-item.active {
  background: #e3f2fd;
  color: var(--color-primary);
  border-left-color: var(--color-primary);
  font-weight: 500;
}

.nav-icon {
  font-size: 18px;
}

/* ---------- 主内容区 ---------- */
.main-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.view-header h2 {
  font-size: 20px;
  font-weight: 600;
}

.view-actions {
  display: flex;
  gap: 8px;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-dark);
}

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

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

.btn-outline {
  background: var(--color-white);
  color: var(--color-text);
  border-color: var(--color-border);
}

.btn-outline:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.btn-block {
  width: 100%;
}

.btn-filter {
  background: var(--color-white);
  color: var(--color-text-light);
  border: 1px solid var(--color-border);
  padding: 4px 12px;
  font-size: 13px;
}

.btn-filter.active {
  background: var(--color-primary);
  color: var(--color-white);
  border-color: var(--color-primary);
}

/* ---------- 表格 ---------- */
.table-container {
  background: var(--color-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}

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

.table th {
  background: #fafafa;
  padding: 12px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--color-text-light);
  border-bottom: 2px solid var(--color-border);
  white-space: nowrap;
}

.table td {
  padding: 12px 14px;
  border-bottom: 1px solid #f0f0f0;
}

.table tr:hover {
  background: #f8faff;
}

.table tr:last-child td {
  border-bottom: none;
}

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

.status-tag.pending {
  background: #f5f5f5;
  color: #757575;
  border: 1px solid #e0e0e0;
}

.status-tag.processing {
  background: #e3f2fd;
  color: #1565c0;
  border: 1px solid #90caf9;
}

.status-tag.completed {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #a5d6a7;
}

.status-tag.cancelled {
  background: #ffebee;
  color: #c62828;
  border: 1px solid #ef9a9a;
}

/* ---------- 优先级标签 ---------- */
.priority-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.priority-tag.normal {
  background: #f5f5f5;
  color: #757575;
}

.priority-tag.urgent {
  background: #fff3e0;
  color: #e65100;
}

.priority-tag.emergency {
  background: #ffebee;
  color: #c62828;
}

.priority-tag.special {
  background: #f3e5f5;
  color: #6a1b9a;
}

.priority-tag.paused {
  background: #eeeeee;
  color: #616161;
}

/* ---------- 进度条 ---------- */
.progress-bar {
  display: flex;
  height: 20px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--color-gray);
  min-width: 140px;
}

.progress-bar .segment {
  height: 100%;
  transition: width 0.3s;
}

.progress-bar .segment.pending-seg {
  background: var(--color-gray);
}

.progress-bar .segment.processing-seg {
  background: var(--color-primary);
}

.progress-bar .segment.completed-seg {
  background: var(--color-success);
}

.progress-text {
  font-size: 12px;
  color: var(--color-text-light);
  margin-top: 2px;
  text-align: center;
}

/* ---------- 看板 ---------- */
.kanban-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.kanban-date-range {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
}

.kanban-date-range input[type="date"] {
  padding: 4px 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 13px;
}

.kanban-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.kanban-card {
  background: var(--color-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  transition: transform 0.15s;
}

.kanban-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.kanban-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.kanban-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
}

.kanban-card-count {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-primary);
}

.kanban-card-stats {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 13px;
}

.kanban-stat {
  text-align: center;
}

.kanban-stat-value {
  font-size: 20px;
  font-weight: 600;
}

.kanban-stat-label {
  color: var(--color-text-light);
  font-size: 12px;
}

.kanban-stat .stat-pending { color: var(--color-gray-dark); }
.kanban-stat .stat-processing { color: var(--color-primary); }
.kanban-stat .stat-completed { color: var(--color-success); }

.kanban-progress-bar {
  display: flex;
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
  background: var(--color-gray);
  margin-bottom: 6px;
}

.kanban-progress-bar .kp-segment {
  height: 100%;
  transition: width 0.3s;
}

.kanban-progress-bar .kp-pending { background: var(--color-gray); }
.kanban-progress-bar .kp-processing { background: var(--color-primary); }
.kanban-progress-bar .kp-completed { background: var(--color-success); }

.kanban-card-rate {
  font-size: 12px;
  color: var(--color-text-light);
  text-align: right;
}

/* ---------- 统计图表区域 ---------- */
.stats-section {
  margin-top: 32px;
}

.stats-divider {
  text-align: center;
  color: var(--color-text-light);
  font-size: 14px;
  margin-bottom: 20px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.stats-divider::before,
.stats-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

.stats-charts {
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
}

.chart-container {
  background: var(--color-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  flex: 1;
  min-width: 300px;
}

/* ---------- 工单过滤器 ---------- */
.orders-filters {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.filter-group label {
  font-size: 13px;
  color: var(--color-text-light);
  white-space: nowrap;
}

.filter-group select,
.filter-group input[type="text"],
.filter-group input[type="date"] {
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 13px;
}

.filter-group input[type="text"] {
  width: 220px;
}

/* ---------- 操作日志标签 ---------- */
.log-action-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  background: #e3f2fd;
  color: #1565c0;
  border: 1px solid #90caf9;
}

/* ---------- 分页 ---------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 20px;
  padding: 12px 0;
}

.pagination .page-btn {
  padding: 6px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-white);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
}

.pagination .page-btn:hover:not(:disabled) {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.pagination .page-btn.active {
  background: var(--color-primary);
  color: var(--color-white);
  border-color: var(--color-primary);
}

.pagination .page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination .page-info {
  font-size: 13px;
  color: var(--color-text-light);
  margin: 0 8px;
}

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

.modal {
  background: var(--color-white);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  width: 90%;
  max-width: 520px;
  max-height: 80vh;
  overflow-y: auto;
}

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

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

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

.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--color-gray-dark);
  padding: 0 4px;
  line-height: 1;
}

.modal-close:hover {
  color: var(--color-text);
}

.modal-body {
  padding: 20px 24px;
}

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

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

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

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 14px;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

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

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-group {
  flex: 1;
}

/* ---------- 操作按钮组 ---------- */
.action-group {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.action-group .btn {
  padding: 3px 8px;
  font-size: 12px;
}

/* ---------- 工序详情 ---------- */
.process-detail-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.process-detail-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #fafafa;
  border-radius: var(--radius);
  margin-bottom: 4px;
}

.process-detail-item .process-name {
  font-weight: 500;
}

.process-detail-item .process-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---------- 空状态 ---------- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-gray-dark);
}

.empty-state p {
  font-size: 15px;
}

/* ---------- 行操作按钮颜色 ---------- */
.btn-edit {
  background: #e3f2fd;
  color: #1565c0;
  border: 1px solid #90caf9;
}

.btn-edit:hover {
  background: #bbdefb;
}

.btn-delete {
  background: #ffebee;
  color: #c62828;
  border: 1px solid #ef9a9a;
}

.btn-delete:hover {
  background: #ffcdd2;
}

/* ---------- 滚动条美化 ---------- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #aaa;
}

/* ===== 测试数据控制按钮（首页右下角） ===== */
.seed-toggle-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  border: none;
  background: #1a1a2e;
  color: #fff;
  font-size: 20px;
  line-height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  z-index: 10000;
  transition: all 0.2s;
  user-select: none;
  padding: 0;
}
.seed-toggle-btn:hover {
  background: #16213e;
  transform: scale(1.08);
  box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}

/* ===== 种子控制对话框 ===== */
#seedModalContent .modal-body {
  padding: 24px;
}
#seedModalContent .seed-toggle-option {
  border-bottom: 1px solid #f0f0f0;
}
#seedModalContent .seed-toggle-option:last-child {
  border-bottom: none;
}

/* ===== Toast 提示 ===== */
#seedToast {
  animation: toastFadeIn 0.3s ease;
}
@keyframes toastFadeIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
