/**
 * File: server/public/portal/css/components/enterprise-autocomplete.css
 * Enterprise Autocomplete Component Styles
 * Purpose: 企业名称自动补全组件样式
 * Created: 2026-01-17
 */

/* ========== 下拉框容器 ========== */

.enterprise-autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 300px;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  margin-top: 4px;
}

/* ========== 列表项样式 ========== */

.autocomplete-item {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.2s ease;
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.active {
  background-color: #f8f9fa;
}

/* ========== 企业名称与信用代码 ========== */

.enterprise-name {
  font-weight: 500;
  color: #333;
  font-size: 14px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.enterprise-uscc {
  font-size: 12px;
  color: #666;
  font-family: 'Monaco', 'Courier New', monospace;
}

/* ========== 状态徽章 ========== */

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: normal;
  margin-left: 8px;
}

.status-badge.normal {
  background-color: #d4edda;
  color: #155724;
}

.status-badge.abnormal {
  background-color: #f8d7da;
  color: #721c24;
}

/* ========== 空状态提示 ========== */

.autocomplete-empty,
.autocomplete-loading,
.autocomplete-error {
  padding: 20px 16px;
  text-align: center;
  color: #666;
}

.autocomplete-empty p,
.autocomplete-loading p,
.autocomplete-error p {
  margin: 0 0 8px 0;
  font-size: 14px;
}

.autocomplete-empty small {
  color: #999;
  font-size: 12px;
}

/* ========== 错误状态样式 ========== */

.autocomplete-error {
  color: #dc3545;
}

.autocomplete-error .btn-retry {
  margin-top: 8px;
  padding: 6px 16px;
  background-color: #007bff;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  transition: background-color 0.2s ease;
}

.autocomplete-error .btn-retry:hover {
  background-color: #0056b3;
}

/* ========== 自动填充字段高亮 ========== */

.form-control.auto-filled,
input.auto-filled,
select.auto-filled {
  border-left: 3px solid #28a745;
  background-color: #f0f9f4;
  transition: all 0.3s ease;
}

.form-control.auto-filled:focus,
input.auto-filled:focus,
select.auto-filled:focus {
  border-left-color: #28a745;
  background-color: #ffffff;
  box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
}

/* ========== 自动填充提示文本 ========== */

.auto-fill-hint {
  font-size: 12px;
  color: #28a745;
  margin-top: 4px;
  display: flex;
  align-items: center;
}

.auto-fill-hint::before {
  content: '✓';
  margin-right: 4px;
  font-weight: bold;
}

/* ========== 滚动条美化 ========== */

.enterprise-autocomplete-dropdown::-webkit-scrollbar {
  width: 6px;
}

.enterprise-autocomplete-dropdown::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.enterprise-autocomplete-dropdown::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

.enterprise-autocomplete-dropdown::-webkit-scrollbar-thumb:hover {
  background: #999;
}

/* ========== 响应式适配 ========== */

@media (max-width: 768px) {
  .enterprise-autocomplete-dropdown {
    max-height: 250px;
  }

  .autocomplete-item {
    padding: 10px 12px;
  }

  .enterprise-name {
    font-size: 13px;
  }

  .enterprise-uscc {
    font-size: 11px;
  }
}

/* ========== 企业确认模态框 ========== */

.enterprise-confirm-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 9998;
  animation: fadeIn 0.2s ease;
}

.enterprise-confirm-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  z-index: 9999;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: slideDown 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideDown {
  from {
    transform: translate(-50%, -55%);
    opacity: 0;
  }
  to {
    transform: translate(-50%, -50%);
    opacity: 1;
  }
}

/* 模态框头部 */
.enterprise-confirm-modal .modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid #e9ecef;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.enterprise-confirm-modal .modal-header h3 {
  margin: 0;
  font-size: 18px;
  color: #333;
  font-weight: 600;
}

.enterprise-confirm-modal .modal-close {
  background: none;
  border: none;
  font-size: 28px;
  color: #999;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.enterprise-confirm-modal .modal-close:hover {
  background-color: #f0f0f0;
  color: #333;
}

/* 模态框主体 */
.enterprise-confirm-modal .modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.enterprise-confirm-modal .enterprise-info {
  background-color: #f8f9fa;
  padding: 16px;
  border-radius: 6px;
  margin-bottom: 20px;
}

.enterprise-confirm-modal .enterprise-info p {
  margin: 0 0 8px 0;
  font-size: 14px;
  color: #333;
}

.enterprise-confirm-modal .enterprise-info p:last-child {
  margin-bottom: 0;
}

.enterprise-confirm-modal .enterprise-info strong {
  color: #555;
}

/* 字段区域 */
.enterprise-confirm-modal .fields-section {
  margin-bottom: 24px;
}

.enterprise-confirm-modal .fields-section:last-child {
  margin-bottom: 0;
}

.enterprise-confirm-modal .fields-section h4 {
  margin: 0 0 12px 0;
  font-size: 15px;
  color: #555;
  font-weight: 600;
}

.enterprise-confirm-modal .fields-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* 字段项 */
.enterprise-field-item {
  display: flex;
  align-items: flex-start;
  padding: 10px 12px;
  background-color: #f8f9fa;
  border-radius: 4px;
  gap: 8px;
}

.enterprise-field-item.warning {
  background-color: #fff3cd;
}

.enterprise-field-item.manual {
  background-color: #f8f9fa;
  opacity: 0.7;
}

.enterprise-field-item .field-icon {
  font-size: 16px;
  line-height: 1.4;
}

.enterprise-field-item .field-label {
  font-size: 14px;
  color: #555;
  font-weight: 500;
  min-width: 80px;
}

.enterprise-field-item .field-value {
  font-size: 14px;
  color: #333;
  flex: 1;
}

.enterprise-field-item .field-warning {
  font-size: 12px;
  color: #856404;
  margin-top: 4px;
  margin-left: 88px;
}

/* 模态框底部 */
.enterprise-confirm-modal .modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #e9ecef;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.enterprise-confirm-modal .wizard-btn {
  padding: 10px 24px;
  border-radius: 6px;
  border: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.enterprise-confirm-modal .wizard-btn-secondary {
  background-color: #f8f9fa;
  color: #333;
  border: 1px solid #ddd;
}

.enterprise-confirm-modal .wizard-btn-secondary:hover {
  background-color: #e9ecef;
}

.enterprise-confirm-modal .wizard-btn-primary {
  background-color: #1677ff;
  color: #ffffff;
}

.enterprise-confirm-modal .wizard-btn-primary:hover {
  background-color: #0056d6;
}

/* 响应式适配 */
@media (max-width: 768px) {
  .enterprise-confirm-modal {
    width: 95%;
    max-height: 85vh;
  }

  .enterprise-confirm-modal .modal-header {
    padding: 16px 20px;
  }

  .enterprise-confirm-modal .modal-body {
    padding: 20px;
  }

  .enterprise-confirm-modal .modal-footer {
    padding: 12px 20px;
    flex-direction: column-reverse;
  }

  .enterprise-confirm-modal .wizard-btn {
    width: 100%;
  }

  .enterprise-field-item .field-label {
    min-width: 70px;
    font-size: 13px;
  }

  .enterprise-field-item .field-value {
    font-size: 13px;
  }
}
