/* ===================================
   CSS变量 - 科技蓝色主题
   =================================== */
:root {
  /* 主题色 */
  --primary-blue: #0066ff;
  --primary-blue-dark: #0052cc;
  --primary-blue-darker: #003d99;
  --primary-blue-light: #3385ff;

  /* 背景色 */
  --bg-page: #f5f7fa;
  --bg-card: #ffffff;
  --bg-card-secondary: #f8fafc;
  --bg-hover: rgba(0, 102, 255, 0.04);
  --bg-input: #f8fafc;

  /* 文字色 */
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --text-placeholder: #cbd5e1;

  /* 边框色 */
  --border-color: #e2e8f0;
  --border-color-hover: #cbd5e1;
  --border-focus: var(--primary-blue);

  /* 阴影 */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --shadow-blue: 0 0 0 3px rgba(0, 102, 255, 0.1);

  /* 间距 */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;

  /* 圆角 */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
}

/* ===================================
   全局样式
   =================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', 'PingFang SC', sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* 背景装饰 */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    linear-gradient(135deg, rgba(0, 102, 255, 0.02) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(0, 102, 255, 0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
}

/* ===================================
   登录页面样式
   =================================== */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--spacing-md);
}

.login-container {
  position: relative;
  width: 100%;
  max-width: 450px;
}

.login-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: var(--spacing-xl);
  box-shadow: var(--shadow-card), var(--shadow-glow);
  position: relative;
  z-index: 10;
}

.login-header {
  text-align: center;
  margin-bottom: var(--spacing-lg);
}

.company-logo {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--spacing-md);
  background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 30px rgba(0, 102, 255, 0.6);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    box-shadow: 0 0 30px rgba(0, 102, 255, 0.6);
  }

  50% {
    box-shadow: 0 0 50px rgba(0, 102, 255, 0.8);
  }
}

.logo-icon {
  font-size: 36px;
  font-weight: bold;
  color: #fff;
}

.login-header h1 {
  font-size: 32px;
  margin-bottom: var(--spacing-xs);
  background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 14px;
}

.login-form {
  margin-bottom: var(--spacing-md);
}

.form-group {
  margin-bottom: var(--spacing-md);
}

.form-group label {
  display: block;
  margin-bottom: var(--spacing-xs);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 15px;
  transition: all 0.2s ease;
  font-weight: 500;
}

.form-group input:focus {
  outline: none;
  border-color: var(--border-focus);
  background: #ffffff;
  box-shadow: var(--shadow-blue);
}

.form-group input::placeholder {
  color: var(--text-placeholder);
  font-weight: 400;
}

.form-group input::placeholder {
  color: var(--text-muted);
}

.error-message {
  padding: 12px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-md);
  color: #fca5a5;
  font-size: 14px;
  margin-bottom: var(--spacing-md);
}

.btn-primary {
  width: 100%;
  padding: 14px 24px;
  background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%);
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 102, 255, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(0, 102, 255, 0.5);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.login-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* 背景动画线条 */
.background-animation {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.circuit-line {
  position: absolute;
  background: linear-gradient(90deg, transparent, var(--primary-blue), transparent);
  height: 2px;
  width: 100%;
  opacity: 0.3;
  animation: circuit 8s linear infinite;
}

.circuit-line:nth-child(1) {
  top: 20%;
  animation-delay: 0s;
}

.circuit-line:nth-child(2) {
  top: 50%;
  animation-delay: 2s;
}

.circuit-line:nth-child(3) {
  top: 80%;
  animation-delay: 4s;
}

@keyframes circuit {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(100%);
  }
}

/* ===================================
   主应用页面样式
   =================================== */
.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: var(--spacing-md) var(--spacing-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.company-logo-small {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 102, 255, 0.2);
}

.logo-icon-small {
  font-size: 22px;
  font-weight: bold;
  color: #fff;
}

.app-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.user-info {
  color: var(--text-secondary);
  font-size: 14px;
  white-space: nowrap;
}

.btn-logout {
  padding: 8px 16px;
  background: white;
  border: 1px solid #fee2e2;
  border-radius: var(--radius-md);
  color: #ef4444;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-logout::before {
  content: '⏻';
  font-size: 14px;
}

.btn-logout:hover {
  background: #fef2f2;
  border-color: #ef4444;
  color: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.1);
}

.btn-logout:active {
  transform: translateY(0);
}

.main-content {
  flex: 1;
  padding: var(--spacing-lg);
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

/* 统计仪表板 */
.dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--spacing-md) var(--spacing-lg);
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary-blue);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  font-size: 36px;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(0, 102, 255, 0.1) 0%, rgba(0, 102, 255, 0.05) 100%);
  border-radius: var(--radius-md);
}

.stat-info h3 {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--primary-blue);
  letter-spacing: -1px;
}

.stat-info p {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
}

/* 标签页 */
.tabs {
  display: flex;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
  border-bottom: 2px solid var(--border-color);
}

.tab-btn {
  padding: 12px 24px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-secondary);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: -2px;
}

.tab-btn:hover {
  color: var(--primary-blue-light);
}

.tab-btn.active {
  color: var(--primary-blue);
  border-bottom-color: var(--primary-blue);
}

/* 工具栏 */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

.search-input {
  flex: 1;
  max-width: 400px;
  padding: 10px 16px;
  background: var(--bg-input);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--border-focus);
  background: #ffffff;
  box-shadow: var(--shadow-blue);
}

.search-input::placeholder {
  color: var(--text-placeholder);
  font-weight: 400;
}

.btn-primary {
  padding: 10px 20px;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  padding: 10px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-secondary:hover {
  border-color: var(--primary-blue);
  background: rgba(0, 102, 255, 0.05);
}

/* 表格容器 */
.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 800px;
}

thead {
  background: linear-gradient(to bottom, #f8fafc 0%, #f1f5f9 100%);
  position: sticky;
  top: 0;
  z-index: 10;
}

th {
  padding: 16px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
}

td {
  padding: 8px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 14px;
  position: relative;
}

/* 可编辑单元格 */
td.editable {
  cursor: text;
  transition: all 0.2s ease;
}

td.editable:hover {
  background: var(--bg-hover);
}

/* 单元格输入框 */
td input,
td select,
td textarea {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-input);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  transition: all 0.2s ease;
}

td input:focus,
td select:focus,
td textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  background: #ffffff;
  box-shadow: var(--shadow-blue);
}

td input::placeholder,
td textarea::placeholder {
  color: var(--text-placeholder);
  font-weight: 400;
}

td select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}

td textarea {
  resize: vertical;
  min-height: 60px;
  line-height: 1.5;
}

/* 单元格显示文本 */
td .cell-display {
  padding: 8px;
  min-height: 32px;
  display: block;
  word-wrap: break-word;
}

tbody tr {
  transition: all 0.2s ease;
}

tbody tr:hover {
  background: var(--bg-hover);
}

tbody tr:last-child td {
  border-bottom: none;
}

/* 新行样式 */
tr.new-row {
  background: rgba(0, 102, 255, 0.05);
}

tr.new-row td {
  border-bottom: 2px solid var(--primary-blue);
}

/* 修改的行高亮 */
tr.modified {
  background: rgba(34, 197, 94, 0.05);
}

/* 操作列 */
td.actions {
  white-space: nowrap;
  text-align: center;
  padding: 4px 8px;
}

.btn-action {
  padding: 6px 12px;
  margin-right: 6px;
  background: rgba(0, 102, 255, 0.1);
  border: 1px solid rgba(0, 102, 255, 0.3);
  border-radius: var(--radius-sm);
  color: var(--primary-blue-light);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-action:hover {
  background: rgba(0, 102, 255, 0.2);
  border-color: var(--primary-blue);
}

.btn-save {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.3);
  color: #86efac;
}

.btn-save:hover {
  background: rgba(34, 197, 94, 0.2);
  border-color: rgba(34, 197, 94, 0.5);
}

.btn-delete {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.btn-delete:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.5);
}

.btn-cancel {
  background: rgba(100, 116, 139, 0.1);
  border-color: rgba(100, 116, 139, 0.3);
  color: var(--text-muted);
}

.btn-cancel:hover {
  background: rgba(100, 116, 139, 0.2);
  border-color: rgba(100, 116, 139, 0.5);
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: var(--spacing-xl);
  color: var(--text-muted);
}

.empty-state p {
  font-size: 16px;
  margin-bottom: var(--spacing-sm);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .app-header {
    flex-direction: column;
    gap: var(--spacing-sm);
    align-items: flex-start;
  }

  .header-right {
    width: 100%;
    justify-content: space-between;
  }

  .dashboard {
    grid-template-columns: repeat(2, 1fr);
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-input {
    max-width: 100%;
  }

  .tabs {
    overflow-x: auto;
  }

  .tab-btn {
    flex-shrink: 0;
  }
}

@media (max-width: 480px) {
  .dashboard {
    grid-template-columns: 1fr;
  }
}

/* ===================================
   模态框样式
   =================================== */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  overflow: auto;
}

.modal-content {
  background-color: var(--bg-card);
  margin: 5% auto;
  padding: 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 600px;
  box-shadow: var(--shadow-lg);
  position: relative;
  animation: modalFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-10px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-md) var(--spacing-lg);
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-card-secondary);
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.modal-body {
  padding: var(--spacing-lg);
  max-height: 75vh;
  overflow-y: auto;
}

.btn-close {
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  padding: 4px;
  border-radius: var(--radius-sm);
}

.btn-close:hover {
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.05);
}

/* 徽章样式 */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
}

.badge-primary {
  background: rgba(0, 102, 255, 0.1);
  color: var(--primary-blue);
  border: 1px solid rgba(0, 102, 255, 0.2);
}

.badge-secondary {
  background: rgba(100, 116, 139, 0.1);
  color: var(--text-secondary);
  border: 1px solid rgba(100, 116, 139, 0.2);
}

/* 小按钮样式 */
.btn-sm {
  padding: 4px 8px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: white;
  transition: all 0.2s;
}

.btn-sm:hover {
  border-color: var(--primary-blue);
  color: var(--primary-blue);
}

.btn-sm.btn-delete {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.05);
}

.btn-sm.btn-delete:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: #ef4444;
}

.btn-sm:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}