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

:root {
  --primary: #e74c3c;
  --primary-dark: #c0392b;
  --success: #27ae60;
  --warning: #f39c12;
  --danger: #e74c3c;
  --info: #3498db;
  --dark: #2c3e50;
  --light: #ecf0f1;
  --gray: #95a5a6;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #f5f6fa;
  color: #333;
  line-height: 1.6;
}

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

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

.login-box {
  background: white;
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

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

.login-header h1 {
  font-size: 28px;
  color: var(--dark);
  margin-bottom: 8px;
}

.login-header p {
  color: var(--gray);
  font-size: 14px;
}

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

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--dark);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.btn-primary {
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.3s;
}

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

.btn-secondary {
  padding: 12px 20px;
  background: var(--info);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.3s;
  white-space: nowrap;
}

.btn-secondary:hover {
  background: #2980b9;
}

.btn-secondary:disabled {
  background: #bdc3c7;
  cursor: not-allowed;
}

/* 登录方式切换 */
.login-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 25px;
  border-bottom: 2px solid #eee;
}

.login-tab {
  flex: 1;
  padding: 12px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 14px;
  color: var(--gray);
  cursor: pointer;
  transition: all 0.3s;
  margin-bottom: -2px;
}

.login-tab:hover {
  color: var(--dark);
}

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

/* 短信验证码组合 */
.sms-code-group {
  display: flex;
  gap: 10px;
}

.sms-code-group input {
  flex: 1;
}

.sms-code-group button {
  min-width: 120px;
}

.login-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--gray);
}

/* 后台布局 */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: var(--dark);
  color: white;
  padding: 20px 0;
}

.sidebar-header {
  padding: 0 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h2 {
  font-size: 18px;
}

.sidebar-menu {
  list-style: none;
  padding: 20px 0;
}

.sidebar-menu li {
  padding: 0;
}

.sidebar-menu a {
  display: block;
  padding: 12px 20px;
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  transition: all 0.3s;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
  background: rgba(255,255,255,0.1);
  color: white;
}

.sidebar-menu a i {
  margin-right: 10px;
}

.main-content {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 15px 20px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.topbar h1 {
  font-size: 20px;
  color: var(--dark);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-info span {
  color: var(--gray);
}

.btn-logout {
  padding: 8px 16px;
  background: var(--danger);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

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

.stat-card {
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.stat-card h3 {
  font-size: 14px;
  color: var(--gray);
  margin-bottom: 8px;
}

.stat-card .value {
  font-size: 32px;
  font-weight: bold;
  color: var(--dark);
}

.stat-card.warning .value { color: var(--warning); }
.stat-card.danger .value { color: var(--danger); }
.stat-card.success .value { color: var(--success); }

/* 表格 */
.table-container {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  overflow: hidden;
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid #eee;
}

.table-header h2 {
  font-size: 16px;
}

.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.3s;
}

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

.btn:hover { opacity: 0.9; }

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

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

th {
  background: #f8f9fa;
  font-weight: 500;
  color: var(--dark);
}

.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
}

.status-normal { background: #d4edda; color: #155724; }
.status-warning { background: #fff3cd; color: #856404; }
.status-danger { background: #f8d7da; color: #721c24; }

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

.modal.show {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #eee;
}

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

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--gray);
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 15px 20px;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.btn-cancel {
  padding: 10px 20px;
  background: #eee;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

/* 巡检页（移动端） */
.inspect-page {
  min-height: 100vh;
  background: #f5f6fa;
  padding: 20px;
}

.inspect-header {
  text-align: center;
  padding: 20px 0;
}

.inspect-header h1 {
  font-size: 20px;
  color: var(--dark);
}

.equipment-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.equipment-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.info-item {
  display: flex;
  flex-direction: column;
}

.info-item label {
  font-size: 12px;
  color: var(--gray);
  margin-bottom: 4px;
}

.info-item span {
  font-size: 14px;
  color: var(--dark);
  font-weight: 500;
}

.check-list {
  background: white;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.check-list h3 {
  margin-bottom: 15px;
  font-size: 16px;
}

.check-item {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #eee;
}

.check-item:last-child {
  border-bottom: none;
}

.check-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-right: 12px;
}

.check-item label {
  flex: 1;
  font-size: 14px;
}

.photo-upload {
  background: white;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.photo-upload h3 {
  margin-bottom: 15px;
  font-size: 16px;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.photo-item {
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-add {
  aspect-ratio: 1;
  border: 2px dashed #ddd;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--gray);
  font-size: 24px;
}

.photo-add:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.submit-btn {
  width: 100%;
  padding: 16px;
  background: var(--success);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
}

.submit-btn:hover {
  opacity: 0.9;
}

/* 历史记录 */
.history-section {
  background: white;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.history-section h3 {
  margin-bottom: 15px;
  font-size: 16px;
}

.history-item {
  padding: 15px 0;
  border-bottom: 1px solid #eee;
}

.history-item:last-child {
  border-bottom: none;
}

.history-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.history-date {
  font-weight: 500;
  color: var(--dark);
}

.history-user {
  color: var(--gray);
  font-size: 13px;
}

.history-results {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.result-tag {
  padding: 4px 10px;
  background: #d4edda;
  color: #155724;
  border-radius: 4px;
  font-size: 12px;
}

.result-tag.fail {
  background: #f8d7da;
  color: #721c24;
}

/* 预警 */
.alert-list {
  margin-bottom: 20px;
}

.alert-item {
  display: flex;
  align-items: center;
  padding: 15px 20px;
  background: white;
  border-radius: 8px;
  margin-bottom: 10px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.alert-item.urgent {
  border-left: 4px solid var(--danger);
}

.alert-item.warning {
  border-left: 4px solid var(--warning);
}

.alert-icon {
  font-size: 24px;
  margin-right: 15px;
}

.alert-info {
  flex: 1;
}

.alert-info h4 {
  font-size: 14px;
  margin-bottom: 4px;
}

.alert-info p {
  font-size: 12px;
  color: var(--gray);
}

/* 响应式 */
@media (max-width: 768px) {
  .sidebar {
    width: 60px;
  }
  
  .sidebar-header h2,
  .sidebar-menu a span {
    display: none;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  table {
    font-size: 13px;
  }
  
  th, td {
    padding: 10px;
  }
}
