/* 钲鹏机床ERP - 模态框样式 V3.0 */

.hidden { display: none !important; }

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-container {
  background: var(--bg-card);
  border-radius: 0;
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  transform: translateY(20px) scale(0.97);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.active .modal-container {
  transform: translateY(0) scale(1);
}

/* 宽模态（流程图编辑器等）- 与默认一致全屏 */
.modal-container.modal-wide {
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  max-height: 100vh;
  border-radius: 0;
  margin: 0;
}
.modal-container.modal-wide .modal-body {
  flex: 1;
  overflow-y: auto;
}

/* 满屏模态（用户要求直接满屏） */
.modal-container.modal-fullscreen {
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  max-height: 100vh;
  border-radius: 0;
  margin: 0;
}
.modal-container.modal-fullscreen .modal-body {
  flex: 1;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.modal-close {
  width: 34px;
  height: 34px;
  background: var(--bg);
  border: none;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  color: var(--text-light);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--danger-light);
  color: var(--danger);
}

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Toast */
.toast-container {
  position: fixed;
  top: 76px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastSlideIn 0.3s ease;
  background: var(--bg-card);
  min-width: 300px;
  max-width: 440px;
  border: 1px solid var(--border);
}

.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--danger); }
.toast-warning { border-left: 4px solid var(--warning); }
.toast-info { border-left: 4px solid var(--info); }

.toast-icon { font-size: 20px; }
.toast-message { flex: 1; color: var(--text); }

@keyframes toastSlideIn {
  from { transform: translateX(60px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* 通用弹窗（spr前缀 - 兼容跨模块使用） */
.spr-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: sprFadeIn 0.2s ease;
}
.spr-modal {
  background: var(--bg-card, #fff);
  border-radius: 16px;
  padding: 24px;
  width: 90%;
  max-width: 500px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: sprSlideUp 0.25s ease;
}
.spr-modal h3 {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 700;
}
@keyframes sprFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes sprSlideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ========== 打印模板编辑器 ========== */
.pte-editor {
  display: flex;
  flex-direction: column;
  min-height: 400px;
}

.pte-tabbar {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.pte-tab {
  padding: 8px 16px;
  border: none;
  background: var(--bg);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  border-radius: var(--radius) var(--radius) 0 0;
  transition: var(--transition);
  white-space: nowrap;
  font-weight: 500;
}

.pte-tab:hover { background: #e8e8e8; color: var(--text); }
.pte-tab.active {
  background: #fff;
  color: var(--primary);
  font-weight: 650;
  border-bottom: 2px solid var(--primary);
  margin-bottom: -2px;
}

.pte-tab-content { display: none; padding: 4px 0; }
.pte-tab-content.active { display: block; }

.pte-section-title {
  font-size: 14px;
  font-weight: 650;
  color: var(--text);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.pte-hint {
  font-weight: 400;
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 8px;
}

.pte-fields-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
  max-height: 320px;
  overflow-y: auto;
}

.pte-field-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: background 0.15s;
}

.pte-field-row:hover { background: var(--primary-bg); }

.pte-drag { color: var(--text-muted); font-size: 16px; cursor: grab; user-select: none; }
.pte-check { flex: 1; display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.pte-check input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--primary); }
.pte-label-input { width: 120px !important; padding: 4px 8px !important; font-size: 12px !important; height: 28px !important; }
.pte-width-input { width: 70px !important; padding: 4px 6px !important; font-size: 12px !important; height: 28px !important; }
.pte-move { padding: 2px 6px !important; font-size: 10px !important; height: 24px !important; line-height: 1 !important; }
.pte-sig-row .pte-check { min-width: 180px; }
.pte-margin-grid { grid-template-columns: 1fr 1fr 1fr 1fr; }

.pte-css-editor {
  width: 100%;
  min-height: 150px;
  font-family: 'Consolas', 'Courier New', monospace !important;
  font-size: 12px !important;
  line-height: 1.5;
  resize: vertical;
}

.pte-body-editor {
  width: 100% !important;
  min-height: 280px !important;
  font-size: 13px !important;
  line-height: 1.8 !important;
  font-family: 'Microsoft YaHei', 'SimSun', serif !important;
  resize: vertical;
  padding: 12px !important;
  border: 2px solid var(--border) !important;
  border-radius: var(--radius) !important;
  transition: border-color 0.2s;
}

.pte-body-editor:focus {
  border-color: var(--primary) !important;
  outline: none;
  box-shadow: 0 0 0 3px rgba(79,110,247,0.08);
}

.pte-version-select { flex: 1; min-width: 180px; }

.form-check-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  cursor: pointer;
}

.form-check-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

/* 打印预览 toolbar */
.preview-toolbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #1a1f36;
  color: #fff;
  padding: 10px 18px;
  display: flex;
  gap: 14px;
  align-items: center;
  z-index: 9999;
  font-size: 14px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

.preview-toolbar .btn-print {
  background: var(--primary);
  color: #fff;
  padding: 7px 18px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 550;
  transition: var(--transition);
}

.preview-toolbar .btn-print:hover {
  background: var(--primary-dark);
}

.preview-toolbar .btn-close {
  background: rgba(255,255,255,0.15);
  color: #fff;
  padding: 7px 18px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
}

.preview-toolbar .btn-close:hover {
  background: rgba(255,255,255,0.25);
}

/* ========== 字段显隐配置面板 ========== */
.field-config-btn-inline {
  transition: all 0.2s;
}
.field-config-btn-inline:hover {
  background: #e67e22 !important;
  color: #fff !important;
  border-color: #e67e22 !important;
}

.field-config-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: sprFadeIn 0.2s ease;
}

.field-config-panel {
  background: #fff;
  border-radius: 16px;
  width: 90%;
  max-width: 420px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: sprSlideUp 0.25s ease;
}

.field-config-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e8e8e8;
}
.field-config-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #1a1f36;
}
.field-config-close {
  width: 32px;
  height: 32px;
  border: none;
  background: #f0f0f0;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  color: #888;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.field-config-close:hover {
  background: #ff4d4f;
  color: #fff;
}

.field-config-body {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
}
.field-config-tip {
  font-size: 13px;
  color: #888;
  margin: 0 0 12px;
  line-height: 1.5;
}

.field-config-quick {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.field-config-quick .btn-xs {
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 6px;
  border: 1px solid #d0d0d0;
  background: #f8f8f8;
  cursor: pointer;
  transition: all 0.2s;
}
.field-config-quick .btn-xs:hover {
  background: #e67e22;
  color: #fff;
  border-color: #e67e22;
}

.field-config-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 40vh;
  overflow-y: auto;
}
.field-config-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 14px;
  color: #333;
}
.field-config-item:hover {
  background: #f5f7ff;
}
.field-config-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #e67e22;
  cursor: pointer;
  flex-shrink: 0;
}

.field-config-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid #e8e8e8;
  font-size: 13px;
}
.field-config-footer .btn-primary {
  background: #e67e22;
  color: #fff;
  border: none;
  padding: 7px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s;
}
.field-config-footer .btn-primary:hover {
  background: #d35400;
}
