/* 优化后的 ERP 系统样式 */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f0f2f5;
  color: #2c3e50;
  line-height: 1.6;
}

/* 登录页 */
#loginPage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
  background: white;
  border-radius: 16px;
  padding: 40px 36px;
  width: 380px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-box h2 {
  text-align: center;
  margin-bottom: 8px;
  font-size: 22px;
  color: #333;
}

.login-box .sub {
  text-align: center;
  color: #999;
  font-size: 13px;
  margin-bottom: 28px;
}

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

.login-box label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 500;
  color: #555;
}

.login-box input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 15px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-box input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.login-box .btn-login {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
  margin-top: 8px;
}

.login-box .btn-login:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.login-box .error {
  color: #e74c3c;
  font-size: 13px;
  margin-top: 10px;
  text-align: center;
  display: none;
}

/* 主应用 */
#appPage {
  display: none;
}

.header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px 30px;
  display: flex;
  align-items: center;
  gap: 15px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header h1 {
  font-size: 24px;
  font-weight: 700;
}

.header .logo {
  font-size: 30px;
}

.header .user-area {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.header .user-area span {
  font-size: 14px;
  opacity: 0.9;
}

.header .user-area button {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  padding: 6px 14px;
  font-size: 13px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.header .user-area button:hover {
  background: rgba(255, 255, 255, 0.35);
  transform: translateY(-1px);
}

.container {
  max-width: 1200px;
  margin: 30px auto;
  padding: 0 20px;
}

/* 标签页 */
.tabs {
  display: flex;
  gap: 5px;
  margin-bottom: 20px;
  background: white;
  border-radius: 10px;
  padding: 5px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.tab {
  padding: 12px 24px;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.3s;
  font-size: 14px;
  font-weight: 500;
}

.tab:hover {
  background: #f0f0f0;
  transform: translateY(-1px);
}

.tab.active {
  background: #667eea;
  color: white;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* 卡片 */
.card {
  background: white;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  margin-bottom: 20px;
  transition: box-shadow 0.3s, transform 0.3s;
}

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

.card h2 {
  font-size: 18px;
  margin-bottom: 20px;
  color: #333;
  border-bottom: 2px solid #f0f0f0;
  padding-bottom: 10px;
}

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

th, td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #eee;
  font-size: 14px;
}

th {
  background: #f8f9fa;
  font-weight: 600;
  color: #555;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
}

th:hover {
  background: #e9ecef;
}

td {
  color: #2c3e50;
}

tr {
  transition: background 0.2s;
}

tr:hover {
  background: #f8f9fa;
}

/* 按钮 */
.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #5568d3, #653a91);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.btn-danger {
  background: #e74c3c;
  color: white;
}

.btn-danger:hover {
  background: #c0392b;
}

.btn-success {
  background: #27ae60;
  color: white;
}

.btn-success:hover {
  background: #219a52;
}

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

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

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  font-size: 14px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

/* 弹窗 */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
}

.modal.show {
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.modal-content {
  background: white;
  border-radius: 12px;
  padding: 24px;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(50px); }
  to { opacity: 1; transform: translateY(0); }
}

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

.modal-header h3 {
  font-size: 18px;
}

.close {
  font-size: 24px;
  cursor: pointer;
  color: #999;
  transition: color 0.2s, transform 0.2s;
}

.close:hover {
  color: #333;
  transform: rotate(90deg);
}

/* 统计卡片 */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.stat-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s, box-shadow 0.3s;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.stat-card h3 {
  font-size: 14px;
  color: #888;
  margin-bottom: 10px;
}

.stat-card .value {
  font-size: 28px;
  font-weight: bold;
  color: #667eea;
}

/* 其他 */
.badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.badge-in {
  background: #d4edda;
  color: #155724;
}

.badge-out {
  background: #f8d7da;
  color: #721c24;
}

.empty {
  text-align: center;
  padding: 40px;
  color: #999;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .header {
    padding: 15px 20px;
    flex-wrap: wrap;
  }
  
  .header h1 {
    font-size: 20px;
  }
  
  .container {
    margin: 20px auto;
    padding: 0 15px;
  }
  
  .tabs {
    flex-wrap: wrap;
  }
  
  .tab {
    padding: 10px 18px;
    font-size: 13px;
  }
  
  .card {
    padding: 18px;
    border-radius: 12px;
  }
  
  table {
    font-size: 12px;
  }
  
  th, td {
    padding: 10px 8px;
  }
  
  .btn {
    padding: 8px 14px;
    font-size: 13px;
  }
  
  .modal-content {
    width: 95%;
    padding: 20px;
  }
  
  .stats {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .header h1 {
    font-size: 18px;
  }
  
  .login-box {
    width: 95%;
    padding: 35px 25px;
  }
  
  .tab {
    padding: 8px 14px;
    font-size: 12px;
  }
}
