/* 核心统一样式库 - 车辆参数配置系统 */
:root {
  /* 主色调 */
  --primary-color: #3498db;
  --primary-dark: #2980b9;
  --primary-light: #5dade2;
  
  /* 功能色 */
  --success-color: #27ae60;
  --success-dark: #229954;
  --warning-color: #f39c12;
  --warning-dark: #e67e22;
  --danger-color: #e74c3c;
  --danger-dark: #c0392b;
  --info-color: #17a2b8;
  
  /* 中性色 */
  --bg-color: #f8f9fa;
  --bg-dark: #343a40;
  --text-color: #333;
  --text-light: #6c757d;
  --border-color: #dee2e6;
  --shadow-color: rgba(0,0,0,0.1);
  
  /* 尺寸和间距 */
  --border-radius: 6px;
  --border-radius-lg: 8px;
  --border-radius-sm: 4px;
  --box-shadow: 0 2px 8px var(--shadow-color);
  --box-shadow-lg: 0 4px 12px var(--shadow-color);
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
}

/* 基础重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
}

/* 统一容器 */
.unified-container {
  max-width: 1400px;
  margin: 0 auto;
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  overflow: hidden;
}

.unified-header {
  background: linear-gradient(135deg, #1a2a6c, #b21f1f, #fdbb2d);
  color: white;
  padding: var(--spacing-xl);
  text-align: center;
  position: relative;
}

.unified-header h1 {
  font-size: 2.2rem;
  margin-bottom: var(--spacing-sm);
  font-weight: 600;
}

.unified-header .subtitle {
  font-size: 1.1rem;
  opacity: 0.9;
}

/* 统一导航 */
.unified-tab-navigation {
  display: flex;
  background: white;
  border-bottom: 2px solid var(--border-color);
  padding: 0 var(--spacing-md);
}

.unified-tab-btn {
  padding: var(--spacing-md) var(--spacing-lg);
  background: none;
  border: none;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.3s ease;
  font-size: 1rem;
  color: var(--text-light);
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.unified-tab-btn:hover {
  color: var(--primary-color);
  background-color: rgba(52, 152, 219, 0.05);
}

.unified-tab-btn.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
  font-weight: 600;
}

.unified-tab-btn i {
  font-size: 1.1rem;
}

/* 内容区域 */
.unified-content {
  padding: var(--spacing-xl);
  min-height: 500px;
}

/* 卡片组件 */
.unified-card {
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  border: 1px solid var(--border-color);
}

.unified-card-header {
  display: flex;
  justify-content: between;
  align-items: center;
  margin-bottom: var(--spacing-md);
  padding-bottom: var(--spacing-sm);
  border-bottom: 1px solid var(--border-color);
}

.unified-card-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-color);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

/* 按钮样式 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.3s ease;
  line-height: 1;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary-dark);
  transform: translateY(-1px);
}

.btn-success {
  background-color: var(--success-color);
  color: white;
}

.btn-success:hover {
  background-color: var(--success-dark);
}

.btn-warning {
  background-color: var(--warning-color);
  color: white;
}

.btn-warning:hover {
  background-color: var(--warning-dark);
}

.btn-danger {
  background-color: var(--danger-color);
  color: white;
}

.btn-danger:hover {
  background-color: var(--danger-dark);
}

.btn-info {
  background-color: var(--info-color);
  color: white;
}

/* 表单样式 */
.form-group {
  margin-bottom: var(--spacing-lg);
}

.form-label {
  display: block;
  margin-bottom: var(--spacing-sm);
  font-weight: 500;
  color: var(--text-color);
}

.form-control {
  width: 100%;
  padding: var(--spacing-md);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 1rem;
  transition: border-color 0.3s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* 表格样式 */
.unified-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: var(--spacing-md);
}

.unified-table th,
.unified-table td {
  padding: var(--spacing-md);
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.unified-table th {
  background-color: var(--bg-color);
  font-weight: 600;
  color: var(--text-color);
}

.unified-table tr:hover {
  background-color: rgba(52, 152, 219, 0.02);
}

/* 统计卡片 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-xl);
}

.stat-card {
  background: white;
  padding: var(--spacing-lg);
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  text-align: center;
  border-left: 4px solid var(--primary-color);
}

.stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: var(--spacing-sm);
}

.stat-label {
  color: var(--text-light);
  font-size: 0.9rem;
}

/* 模块特定样式 */
.module-container {
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  overflow: hidden;
}

.module-header {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: white;
  padding: var(--spacing-lg);
}

.module-content {
  padding: var(--spacing-lg);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .unified-tab-navigation {
    flex-direction: column;
    padding: 0;
  }
  
  .unified-tab-btn {
    justify-content: center;
    border-bottom: 1px solid var(--border-color);
    border-left: 3px solid transparent;
  }
  
  .unified-tab-btn.active {
    border-bottom-color: transparent;
    border-left-color: var(--primary-color);
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .unified-content {
    padding: var(--spacing-md);
  }
}

/* 工具提示 */
.tooltip {
  position: relative;
  display: inline-block;
}

.tooltip .tooltiptext {
  visibility: hidden;
  width: 200px;
  background-color: var(--bg-dark);
  color: white;
  text-align: center;
  border-radius: var(--border-radius);
  padding: var(--spacing-sm);
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.3s;
}

.tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 1;
}

/* 加载动画 */
.loading-spinner {
  border: 3px solid #f3f3f3;
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 状态指示器 */
.status-indicator {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: var(--spacing-sm);
}

.status-active {
  background-color: var(--success-color);
}

.status-inactive {
  background-color: var(--danger-color);
}

.status-pending {
  background-color: var(--warning-color);
}

/* 前后台通用样式 */
.admin-section {
  border-left: 4px solid var(--warning-color);
}

.frontend-section {
  border-left: 4px solid var(--success-color);
}

/* 模块安装界面 */
.module-install-section {
  background: var(--bg-color);
  padding: var(--spacing-lg);
  border-radius: var(--border-radius);
  border: 2px dashed var(--border-color);
  text-align: center;
}

.module-install-section:hover {
  border-color: var(--primary-color);
}

/* 图标库支持 */
.fas, .far, .fab {
  font-family: 'Font Awesome 5 Free';
  font-weight: 900;
}

/* 参数表格样式 */
.parameters-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: var(--spacing-md);
  font-size: 0.9rem;
}

.parameters-table th,
.parameters-table td {
  padding: var(--spacing-sm) var(--spacing-md);
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.parameters-table th {
  background-color: var(--bg-color);
  font-weight: 600;
  color: var(--text-color);
  white-space: nowrap;
}

.parameters-table tr:hover {
  background-color: rgba(52, 152, 219, 0.02);
}

/* 参数表格列宽定义 */
.table-parameter-name { 
  width: 25%; 
  font-weight: 500;
}

.table-chinese-name { 
  width: 25%; 
}

.table-position { 
  width: 15%; 
  text-align: center;
  font-family: monospace;
  font-weight: 500;
}

.table-start-byte { 
  width: 10%; 
  text-align: center;
  font-family: monospace;
  font-weight: 500;
}

.table-start-bit { 
  width: 10%; 
  text-align: center;
  font-family: monospace;
  font-weight: 500;
}

.table-bit-status { 
  width: 10%; 
  text-align: center;
  font-family: monospace;
  font-weight: 600;
}

.table-select { 
  width: 5%; 
  text-align: center;
}

/* 字节信息单元格样式 */
.byte-info {
  font-family: monospace;
  font-weight: 500;
  text-align: center;
}

/* 响应式表格 */
@media (max-width: 768px) {
  .parameters-table {
    font-size: 0.8rem;
  }
  
  .parameters-table th,
  .parameters-table td {
    padding: var(--spacing-xs) var(--spacing-sm);
  }
  
  .table-parameter-name, 
  .table-chinese-name { 
    width: 30%; 
  }
  
  .table-position, 
  .table-start-byte, 
  .table-start-bit { 
    width: 13%; 
  }
}

/* 打印样式 */
@media print {
  .unified-tab-navigation,
  .btn {
    display: none;
  }
  
  .unified-container {
    box-shadow: none;
  }
}
