/* 使用全局 CSS 变量 */
.model-settings {
  min-height: 100vh;
  background: var(--bg-primary);
  position: relative;
  overflow: hidden;
}

/* 背景效果 */
.bg-effects {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.4;
}

.glow-1 {
  width: 500px;
  height: 500px;
  background: var(--accent-primary);
  top: -200px;
  right: -100px;
}

.glow-2 {
  width: 400px;
  height: 400px;
  background: var(--accent-secondary);
  bottom: -100px;
  left: -100px;
}

/* 页面头部 */
.page-header {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
}

.header-content {
  text-align: center;
}

.page-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.title-icon {
  color: var(--accent-primary);
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-tertiary);
  margin: 4px 0 0;
}

.header-left, .header-right {
  flex: 1;
}

.header-right {
  display: flex;
  justify-content: flex-end;
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  background: transparent !important;
}

.back-btn:hover {
  background: var(--bg-hover) !important;
  color: var(--text-primary);
}

.add-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-primary);
  border: none;
  color: #030407;
  font-weight: 600;
}

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

/* 主内容 */
.page-main {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px;
}

/* 模型列表 */
.models-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 24px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.title-line {
  width: 4px;
  height: 18px;
  background: linear-gradient(180deg, var(--accent-primary), var(--accent-secondary));
  border-radius: 2px;
}

.count-badge {
  font-size: 12px;
  color: var(--text-tertiary);
  background: var(--bg-hover);
  padding: 6px 14px;
  border-radius: 20px;
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 80px 20px;
}

.empty-illustration {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.pulse-ring {
  position: absolute;
  inset: 0;
  border: 2px solid var(--border-subtle);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.5; }
}

.empty-state h3 {
  font-size: 18px;
  color: var(--text-primary);
  margin: 0 0 8px;
}

.empty-state p {
  color: var(--text-tertiary);
  margin: 0 0 24px;
}

/* 模型网格 */
.models-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.model-card {
  position: relative;
  padding: 24px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: fadeInUp 0.4s ease backwards;
  animation-delay: var(--delay);
  overflow: hidden;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.model-card:hover {
  border-color: rgba(0, 212, 255, 0.4);
  transform: translateY(-6px);
  box-shadow: 0 12px 40px rgba(0, 212, 255, 0.15);
}

.model-card.is-default {
  border-color: rgba(52, 211, 153, 0.4);
}

.card-glow {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background: radial-gradient(circle at top right, rgba(0, 212, 255, 0.15), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.model-card:hover .card-glow {
  opacity: 1;
}

.default-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--success);
  background: var(--success-muted);
  padding: 4px 10px;
  border-radius: 6px;
}

.provider-logo {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  color: white;
  margin-bottom: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
}

.model-info {
  margin-bottom: 20px;
}

.model-name-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.model-name {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.model-type-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  border: 1px solid transparent;
}

.model-type-badge.type-chat {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.25);
}

.model-type-badge.type-vlm {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.12);
  border-color: rgba(251, 191, 36, 0.25);
}

.model-type-badge.type-embedding {
  color: #34d399;
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.25);
}

.model-type-badge.type-rerank {
  color: #c084fc;
  background: rgba(192, 132, 252, 0.12);
  border-color: rgba(192, 132, 252, 0.25);
}

.model-endpoint {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.status-badge.connected {
  color: var(--success);
}

.status-badge.disconnected {
  color: var(--danger);
}

.status-badge.untested {
  color: var(--warning);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
}

.status-dot.online,
.status-dot.connected {
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: pulse 2s infinite;
}

.status-dot.disconnected {
  background: var(--danger);
  box-shadow: 0 0 8px var(--danger);
}

.status-dot.untested {
  background: var(--warning);
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

.card-actions {
  display: flex;
  gap: 8px;
}

.action-btn {
  width: 32px;
  height: 32px;
  color: var(--text-tertiary);
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
}

.action-btn:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.action-btn.delete:hover {
  color: var(--danger);
  background: var(--danger-muted);
}

/* 弹窗样式 */
:deep(.model-dialog .el-dialog) {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  overflow: hidden;
}

:deep(.model-dialog .el-dialog__header) {
  padding: 0;
  margin: 0;
}

:deep(.model-dialog .el-dialog__body) {
  padding: 24px;
}

.dialog-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px;
  background: linear-gradient(135deg, var(--accent-primary-muted), rgba(124, 58, 237, 0.1));
  border-bottom: 1px solid var(--border-subtle);
}

.dialog-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-radius: 12px;
  color: #030407;
  box-shadow: 0 4px 16px rgba(0, 212, 255, 0.3);
}

.dialog-title h3 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.dialog-title p {
  font-size: 13px;
  color: var(--text-tertiary);
  margin: 4px 0 0;
}

.dialog-close {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.dialog-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-default);
}

.provider-select {
  width: 100%;
}

.provider-select :deep(.el-select__wrapper),
.provider-select :deep(.el-input__wrapper),
.dialog-input :deep(.el-input__wrapper) {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 4px 16px;
  box-shadow: none !important;
}

.provider-select :deep(.el-select__wrapper:hover),
.provider-select :deep(.el-input__wrapper:hover),
.dialog-input :deep(.el-input__wrapper:hover) {
  border-color: var(--border-default);
}

.provider-select :deep(.el-select__wrapper.is-focused),
.provider-select :deep(.el-input__wrapper.is-focus),
.dialog-input :deep(.el-input__wrapper.is-focus) {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.15) !important;
}

.provider-select :deep(.el-select__placeholder),
.provider-select :deep(.el-input__inner),
.dialog-input :deep(.el-input__inner) {
  color: var(--text-primary);
}

.provider-select :deep(.el-select__placeholder.is-transparent),
.provider-select :deep(.el-input__inner::placeholder),
.dialog-input :deep(.el-input__inner::placeholder) {
  color: rgba(226, 232, 240, 0.38) !important;
}

.provider-select :deep(.el-select__caret) {
  color: var(--text-tertiary);
}

.provider-select :deep(.el-select__placeholder) {
  color: rgba(226, 232, 240, 0.32);
}

.provider-select :deep(.el-select__selected-item) {
  color: var(--text-primary);
}

.provider-select :deep(.el-select__selection) {
  color: var(--text-primary);
}

.provider-select :deep(.el-select__selection),
.provider-select :deep(.el-select__selected-item),
.provider-select :deep(.el-select__selected-item span) {
  color: var(--text-primary) !important;
}

:global(.provider-select-dropdown.el-popper) {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

:global(.provider-select-dropdown .el-select-dropdown) {
  background: var(--bg-elevated) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: 14px;
  padding: 8px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(18px);
}

:global(.provider-select-dropdown .el-select-dropdown__item) {
  background: transparent !important;
  color: var(--text-primary) !important;
  min-height: 64px;
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 500;
  line-height: 1.2;
  display: flex;
  align-items: center;
}

:global(.provider-select-dropdown .el-select-dropdown__item.hover),
:global(.provider-select-dropdown .el-select-dropdown__item:hover) {
  background: rgba(148, 163, 184, 0.08) !important;
}

:global(.provider-select-dropdown .el-select-dropdown__item.is-selected) {
  background: var(--accent-primary-muted) !important;
  color: var(--accent-primary) !important;
  box-shadow: inset 0 0 0 1px rgba(0, 212, 255, 0.18);
}

:global(.provider-select-dropdown .el-popper__arrow),
:global(.provider-select-dropdown .el-select-dropdown__loading),
:global(.provider-select-dropdown .el-select-dropdown__empty) {
  color: var(--text-secondary) !important;
}

.provider-option-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  color: var(--text-primary);
}

.provider-icon {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  color: #030407;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
}

.model-type-icon {
  font-size: 9px;
}

.provider-option-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.provider-option-name {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
}

.provider-option-desc {
  color: rgba(226, 232, 240, 0.48);
  font-size: 12px;
  line-height: 1.4;
}

.dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 24px;
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border-subtle);
}

/* 删除弹窗 */
:deep(.delete-dialog .el-dialog) {
  background: var(--bg-elevated);
  border: 1px solid var(--danger-muted);
  border-radius: 16px;
}

.delete-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 32px 24px 24px;
}

.delete-icon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(248, 113, 113, 0.2), rgba(248, 113, 113, 0.1));
  border: 1px solid var(--danger-muted);
  border-radius: 16px;
  color: var(--danger);
  box-shadow: 0 4px 20px rgba(248, 113, 113, 0.2);
}

.delete-header h3 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.delete-content {
  text-align: center;
  padding: 0 32px 24px;
}

.delete-content p {
  color: var(--text-secondary);
  margin: 0;
  font-size: 15px;
}

.delete-content p strong {
  color: var(--text-primary);
}

.warning-text {
  color: var(--danger) !important;
  font-size: 13px;
  margin-top: 12px !important;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.delete-footer {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 20px 24px;
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border-subtle);
  border-radius: 0 0 16px 16px;
}

/* 响应式 */
@media (max-width: 768px) {
  .page-header {
    flex-direction: column;
    gap: 16px;
    padding: 16px;
  }

  .page-main {
    padding: 16px;
  }

  .provider-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
