/* 梵净山OA系统 - 全局样式 */
:root {
  --primary-color: #1890ff;
  --primary-light: #40a9ff;
  --primary-dark: #096dd9;
  --success-color: #52c41a;
  --warning-color: #faad14;
  --error-color: #f5222d;
  --text-primary: #262626;
  --text-secondary: #595959;
  --text-muted: #8c8c8c;
  --border-color: #d9d9d9;
  --bg-primary: #f0f2f5;
  --bg-white: #ffffff;
  --sidebar-width: 256px;
  --header-height: 64px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-hover: 0 4px 16px rgba(0,0,0,0.12);
}

* {
  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;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
}

/* 登录页样式 */
.login-container {
  min-height: 100vh;
  display: flex;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: white;
  padding: 60px;
}

.login-left h1 {
  font-size: 48px;
  margin-bottom: 20px;
  font-weight: 600;
}

.login-left p {
  font-size: 20px;
  opacity: 0.9;
}

.login-right {
  width: 480px;
  background: white;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px;
  box-shadow: var(--shadow);
}

.login-box h2 {
  font-size: 28px;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.login-box .subtitle {
  color: var(--text-muted);
  margin-bottom: 32px;
}

.login-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
}

.login-tab {
  flex: 1;
  padding: 12px;
  text-align: center;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.3s;
}

.login-tab.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

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

.form-label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-size: 14px;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.3s;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(24,144,255,0.1);
}

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

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

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

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

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

.btn-block {
  width: 100%;
}

.btn-large {
  padding: 14px 32px;
  font-size: 16px;
}

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

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

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

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

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

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

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

/* 侧边栏 */
.sidebar {
  width: var(--sidebar-width);
  background: #001529;
  color: white;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 24px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo {
  width: 36px;
  height: 36px;
  background: var(--primary-color);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  margin-right: 12px;
}

.sidebar-title {
  font-size: 18px;
  font-weight: 500;
}

.sidebar-menu {
  padding: 16px 0;
}

.menu-item {
  padding: 12px 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.3s;
  color: rgba(255,255,255,0.7);
}

.menu-item:hover,
.menu-item.active {
  background: rgba(24,144,255,0.15);
  color: white;
}

.menu-item.active {
  border-right: 3px solid var(--primary-color);
}

.menu-icon {
  width: 20px;
  text-align: center;
}

.menu-subtitle {
  padding: 8px 24px;
  font-size: 12px;
  color: rgba(255,255,255,0.4);
  margin-top: 8px;
}

/* 主内容区 */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
}

.header {
  height: var(--header-height);
  background: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 14px;
}

.breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--primary-color);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
}

.header-icon:hover {
  background: var(--bg-primary);
}

.badge {
  position: absolute;
  top: 0;
  right: 0;
  width: 18px;
  height: 18px;
  background: var(--error-color);
  color: white;
  font-size: 11px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 0.3s;
}

.user-info:hover {
  background: var(--bg-primary);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 500;
}

.user-name {
  font-size: 14px;
}

.user-role {
  font-size: 12px;
  color: var(--text-muted);
}

/* 页面内容 */
.page-content {
  flex: 1;
  padding: 24px;
}

.page-header {
  background: white;
  padding: 24px;
  border-radius: 8px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.page-header h1 {
  font-size: 20px;
  margin-bottom: 8px;
}

.page-header .desc {
  color: var(--text-secondary);
  font-size: 14px;
}

/* 卡片 */
.card {
  background: white;
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

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

.card-title {
  font-size: 16px;
  font-weight: 500;
}

.card-body {
  padding: 24px;
}

/* 统计卡片 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  padding: 24px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.stat-icon.blue { background: rgba(24,144,255,0.1); color: var(--primary-color); }
.stat-icon.green { background: rgba(82,196,26,0.1); color: var(--success-color); }
.stat-icon.orange { background: rgba(250,173,20,0.1); color: var(--warning-color); }
.stat-icon.red { background: rgba(245,34,45,0.1); color: var(--error-color); }

.stat-info h3 {
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 4px;
}

.stat-info p {
  color: var(--text-secondary);
  font-size: 14px;
}

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

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  background: var(--bg-primary);
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 14px;
}

.data-table tbody tr:hover {
  background: rgba(24,144,255,0.02);
}

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

/* 标签 */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.tag-primary { background: rgba(24,144,255,0.1); color: var(--primary-color); }
.tag-success { background: rgba(82,196,26,0.1); color: var(--success-color); }
.tag-warning { background: rgba(250,173,20,0.1); color: var(--warning-color); }
.tag-error { background: rgba(245,34,45,0.1); color: var(--error-color); }
.tag-default { background: var(--bg-primary); color: var(--text-secondary); }

/* 表单 */
.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-bottom: 16px;
}

.form-textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 14px;
  resize: vertical;
  min-height: 100px;
  font-family: inherit;
}

.form-select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 14px;
  background: white;
  cursor: pointer;
}

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

/* 搜索栏 */
.search-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 200px;
  padding: 10px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 14px;
}

/* 分页 */
.pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  padding: 16px 0;
}

.page-btn {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  background: white;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s;
}

.page-btn:hover,
.page-btn.active {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

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

/* 树形菜单 */
.tree-node {
  padding: 10px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 6px;
  transition: all 0.3s;
}

.tree-node:hover {
  background: var(--bg-primary);
}

.tree-node.active {
  background: rgba(24,144,255,0.1);
  color: var(--primary-color);
}

.tree-children {
  padding-left: 24px;
}

.tree-toggle {
  width: 16px;
  text-align: center;
  cursor: pointer;
}

/* 步骤条 */
.steps {
  display: flex;
  margin-bottom: 32px;
}

.step {
  flex: 1;
  display: flex;
  align-items: center;
  position: relative;
}

.step:not(:last-child)::after {
  content: '';
  flex: 1;
  height: 2px;
  background: var(--border-color);
  margin: 0 12px;
}

.step.completed:not(:last-child)::after {
  background: var(--success-color);
}

.step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--border-color);
  color: white;
  font-weight: 500;
  flex-shrink: 0;
}

.step.completed .step-number,
.step.active .step-number {
  background: var(--primary-color);
}

.step-title {
  margin-left: 12px;
  font-size: 14px;
  color: var(--text-secondary);
}

.step.active .step-title,
.step.completed .step-title {
  color: var(--text-primary);
  font-weight: 500;
}

/* 流程图样式 */
.flow-container {
  background: var(--bg-primary);
  border-radius: 8px;
  padding: 32px;
  min-height: 400px;
  position: relative;
}

.flow-node {
  background: white;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 16px 24px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: move;
  position: absolute;
  box-shadow: var(--shadow);
  transition: all 0.3s;
}

.flow-node:hover {
  border-color: var(--primary-color);
  box-shadow: var(--shadow-hover);
}

.flow-node.start { border-color: var(--success-color); }
.flow-node.end { border-color: var(--error-color); }
.flow-node.approval { border-color: var(--primary-color); }

.flow-node-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.flow-node.start .flow-node-icon { background: rgba(82,196,26,0.1); color: var(--success-color); }
.flow-node.end .flow-node-icon { background: rgba(245,34,45,0.1); color: var(--error-color); }
.flow-node.approval .flow-node-icon { background: rgba(24,144,255,0.1); color: var(--primary-color); }

/* 模态框 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

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

.modal {
  background: white;
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow: hidden;
  transform: scale(0.9);
  transition: all 0.3s;
}

.modal-overlay.active .modal {
  transform: scale(1);
}

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

.modal-title {
  font-size: 18px;
  font-weight: 500;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--bg-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}

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

.modal-body {
  padding: 24px;
  max-height: 60vh;
  overflow-y: auto;
}

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

/* 设计器样式 */
.designer-container {
  display: flex;
  height: calc(100vh - 140px);
  gap: 16px;
}

.designer-sidebar {
  width: 280px;
  background: white;
  border-radius: 8px;
  padding: 20px;
  overflow-y: auto;
}

.designer-canvas {
  flex: 1;
  background: white;
  border-radius: 8px;
  padding: 32px;
  overflow-y: auto;
}

.designer-props {
  width: 320px;
  background: white;
  border-radius: 8px;
  padding: 20px;
  overflow-y: auto;
}

.component-item {
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin-bottom: 12px;
  cursor: move;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.3s;
}

.component-item:hover {
  border-color: var(--primary-color);
  background: rgba(24,144,255,0.02);
}

/* 移动端适配 */
@media (max-width: 768px) {
  .login-container {
    flex-direction: column;
  }
  
  .login-left {
    padding: 40px 24px;
    min-height: 200px;
  }
  
  .login-left h1 {
    font-size: 32px;
  }
  
  .login-right {
    width: 100%;
    padding: 32px 24px;
  }
  
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s;
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* 动画 */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

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

/* 隐藏 */
.hidden {
  display: none !important;
}
