/* ========================================
   排产系统 - UI规范样式
   主题色: #779ef9
   ======================================== */

/* CSS Variables */
:root {
  /* 主题色 */
  --color-primary: #779ef9;
  --color-success: #67C23A;
  --color-warning: #E6A23C;
  --color-danger: #F56C6C;
  --color-info: #909399;
  
  /* 状态色 */
  --color-running: #67C23A;
  --color-idle: #E6A23C;
  --color-maintenance: #909399;
  
  /* 文字色 */
  --color-text-primary: #303133;
  --color-text-regular: #606266;
  --color-text-secondary: #909399;
  
  /* 边框色 */
  --color-border: #DCDFE6;
  --color-border-light: #E4E7ED;
  --color-border-lighter: #EBEEF5;
  
  /* 背景色 */
  --color-bg-page: #F5F7FA;
  --color-bg-card: #FFFFFF;
  
  /* 布局 */
  --header-height: 56px;
  --sidebar-width: 200px;
  --content-padding: 24px;
}

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

html, body {
  width: 100%;
  height: 100%;
  font-family: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  color: var(--color-text-primary);
}

body {
  overflow: hidden;
}

/* ========================================
   Layout
   ======================================== */
.layout {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100vh;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: var(--header-height);
  padding: 0 var(--content-padding);
  background: var(--color-primary);
  color: white;
  box-shadow: 0 2px 8px rgba(119, 158, 249, 0.3);
}

.header-title {
  font-size: 18px;
  font-weight: 600;
}

.header-time {
  font-size: 14px;
  opacity: 0.9;
}

/* Main Container */
.main-container {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--color-bg-card);
  border-right: 1px solid var(--color-border-light);
  overflow-y: auto;
}

.menu-item {
  display: block;
  padding: 12px 20px;
  color: var(--color-text-regular);
  text-decoration: none;
  cursor: pointer;
}

.menu-item:hover {
  background: var(--color-border-lighter);
}

.menu-item.active {
  background: rgba(119, 158, 249, 0.1);
  color: var(--color-primary);
  border-left: 3px solid var(--color-primary);
}

.menu-group {
  font-weight: 600;
  color: var(--color-text-primary);
  padding: 12px 20px 8px;
  font-size: 12px;
  text-transform: uppercase;
}

.menu-sub-item {
  padding-left: 32px;
  font-size: 13px;
}

/* Content */
.content {
  flex: 1;
  padding: var(--content-padding);
  background: var(--color-bg-page);
  overflow-y: auto;
}

/* Page Header */
.page-header {
  margin-bottom: 20px;
}

.page-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--color-text-primary);
}

/* ========================================
   Card
   ======================================== */
.card {
  background: var(--color-bg-card);
  border-radius: 4px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
  margin-bottom: 20px;
}

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

.card-title {
  font-weight: 600;
  color: var(--color-text-primary);
}

.card-body {
  padding: 20px;
}

/* ========================================
   Table
   ======================================== */
.table {
  width: 100%;
  border-collapse: collapse;
}

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

.table th {
  background: var(--color-bg-page);
  font-weight: 600;
  color: var(--color-text-primary);
}

.table tr:hover {
  background: var(--color-border-lighter);
}

/* ========================================
   Button
   ======================================== */
.btn {
  display: inline-block;
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.3s;
}

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

.btn-primary:hover {
  background: #6189e8;
}

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

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

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

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

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

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

/* ========================================
   Tag
   ======================================== */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
}

.tag-primary {
  background: rgba(119, 158, 249, 0.1);
  color: var(--color-primary);
}

.tag-success {
  background: rgba(103, 194, 58, 0.1);
  color: var(--color-success);
}

.tag-warning {
  background: rgba(230, 162, 60, 0.1);
  color: var(--color-warning);
}

.tag-danger {
  background: rgba(245, 108, 108, 0.1);
  color: var(--color-danger);
}

.tag-info {
  background: rgba(144, 147, 153, 0.1);
  color: var(--color-info);
}

/* Status Tag with background */
.tag-running {
  background: var(--color-running);
  color: white;
}

.tag-idle {
  background: var(--color-idle);
  color: white;
}

.tag-maintenance {
  background: var(--color-maintenance);
  color: white;
}

/* ========================================
   Form Elements
   ======================================== */
.form-group {
  margin-bottom: 16px;
}

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

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

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

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

/* ========================================
   Progress
   ======================================== */
.progress {
  height: 8px;
  background: var(--color-border-lighter);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--color-primary);
  transition: width 0.3s;
}

.progress-bar.success {
  background: var(--color-success);
}

.progress-bar.warning {
  background: var(--color-warning);
}

.progress-bar.danger {
  background: var(--color-danger);
}

/* ========================================
   Grid
   ======================================== */
.row {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -10px;
}

.col-6 {
  flex: 0 0 50%;
  padding: 0 10px;
}

.col-4 {
  flex: 0 0 33.333%;
  padding: 0 10px;
}

.col-3 {
  flex: 0 0 25%;
  padding: 0 10px;
}

/* ========================================
   Stat Card
   ======================================== */
.stat-card {
  text-align: center;
  padding: 20px;
}

.stat-label {
  font-size: 14px;
  color: var(--color-text-secondary);
  margin-bottom: 12px;
}

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

.stat-value.primary {
  color: var(--color-primary);
}

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

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

/* ========================================
   Empty State
   ======================================== */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--color-text-secondary);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

/* ========================================
   Description List
   ======================================== */
.description {
  border: 1px solid var(--color-border-light);
  border-radius: 4px;
}

.description-item {
  display: flex;
  border-bottom: 1px solid var(--color-border-light);
}

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

.description-label {
  width: 150px;
  padding: 12px 16px;
  background: var(--color-bg-page);
  font-weight: 500;
  color: var(--color-text-regular);
}

.description-value {
  flex: 1;
  padding: 12px 16px;
  color: var(--color-text-primary);
}

/* ========================================
   Dialog / Modal
   ======================================== */
.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;
}

.modal {
  background: white;
  border-radius: 8px;
  width: 500px;
  max-width: 90%;
  max-height: 90%;
  overflow: hidden;
}

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

.modal-title {
  font-size: 16px;
  font-weight: 600;
}

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

.modal-body {
  padding: 20px;
}

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

/* ========================================
   Utility Classes
   ======================================== */
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.ml-10 { margin-left: 10px; }
.mr-10 { margin-right: 10px; }

.text-center { text-align: center; }
.text-right { text-align: right; }

.flex { display: flex; }
.flex-between { justify-content: space-between; }
.flex-center { align-items: center; }
.flex-gap-10 { gap: 10px; }
.flex-gap-20 { gap: 20px; }