/* KV 数据库管理标签页样式 */

.database-manager {
  padding: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #ffffff;
}

/* 工具栏 */
.db-toolbar {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  background: #ffffff;
  border-bottom: 1px solid #f0f0f0;
  align-items: center;
}

.db-select {
  padding: 10px 14px;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  background: #ffffff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  color: #1a1a1a;
  min-width: 140px;
}

.db-select:hover {
  border-color: #1a1a1a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.db-select:focus {
  outline: none;
  border-color: #1a1a1a;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.db-search-input {
  flex: 1;
  max-width: 320px;
  padding: 10px 14px 10px 40px;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  font-size: 13px;
  background: #fafafa;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  color: #1a1a1a;
}

.db-search-input:focus {
  outline: none;
  border-color: #1a1a1a;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.db-search-input::placeholder {
  color: #999;
}

/* 按钮样式 */
.db-btn {
  padding: 10px 18px;
  border: 1px solid #e8e8e8;
  background: #ffffff;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #1a1a1a;
  letter-spacing: 0.3px;
}

.db-btn:hover {
  background: #f8f8f8;
  border-color: #1a1a1a;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.db-btn:active {
  transform: translateY(0);
}

.db-btn-primary {
  background: linear-gradient(135deg, #1a1a1a 0%, #333333 100%);
  color: #ffffff;
  border-color: #1a1a1a;
}

.db-btn-primary:hover {
  background: linear-gradient(135deg, #333333 0%, #4a4a4a 100%);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.db-btn-danger {
  background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
  color: #ffffff;
  border-color: #dc3545;
}

.db-btn-danger:hover {
  background: linear-gradient(135deg, #c82333 0%, #bd2130 100%);
  box-shadow: 0 4px 16px rgba(220, 53, 69, 0.3);
}

.db-btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  gap: 6px;
  border-radius: 6px;
}

.db-btn-sm:hover {
  transform: translateY(-0.5px);
}

/* 提示信息 */
.db-alert {
  padding: 14px 18px;
  border-radius: 8px;
  margin: 16px 20px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  animation: db-slideDown 0.3s ease;
}

@keyframes db-slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.db-alert-success {
  background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
  color: #155724;
  border: 1px solid #c3e6cb;
}

.db-alert-error {
  background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.db-alert-warning {
  background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
  color: #856404;
  border: 1px solid #ffeaa7;
}

.db-alert-info {
  background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
  color: #0c5460;
  border: 1px solid #bee5eb;
}

/* 表格容器 */
.db-table-container {
  flex: 1;
  overflow: auto;
  border: none;
  border-radius: 0;
  margin: 0;
  background: #ffffff;
}

.db-table {
  width: 100%;
  border-collapse: collapse;
}

.db-table thead {
  background: linear-gradient(180deg, #fafafa 0%, #f5f5f5 100%);
  position: sticky;
  top: 0;
  z-index: 10;
}

.db-table th {
  padding: 14px 20px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: #666;
  border-bottom: 1px solid #e8e8e8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.db-table td {
  padding: 14px 20px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: top;
  color: #1a1a1a;
}

.db-table tbody tr:last-child td {
  border-bottom: none;
}

.db-table tbody tr {
  transition: all 0.15s ease;
}

.db-table tbody tr:hover {
  background: linear-gradient(90deg, #fafafa 0%, #ffffff 100%);
}

.db-table code {
  background: #f8f8f8;
  padding: 6px 10px;
  border-radius: 6px;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
  font-size: 12px;
  max-width: 100%;
  overflow: auto;
  display: inline-block;
  word-break: break-all;
  border: 1px solid #e8e8e8;
  color: #333;
}

.db-text-center {
  text-align: center;
  color: #999;
  padding: 60px 20px;
  font-size: 14px;
}

.db-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #1a1a1a;
  border-radius: 50%;
  animation: db-spin 1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  margin: 0 auto;
}

@keyframes db-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* 模态框样式 */
.db-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: db-fadeIn 0.2s ease;
}

@keyframes db-fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.db-modal {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 640px;
  width: 90%;
  max-height: 90vh;
  overflow: auto;
  animation: db-slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes db-slideUp {
  from {
    transform: translateY(30px) scale(0.95);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.db-modal-header {
  padding: 24px 28px;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
}

.db-modal-title {
  font-size: 18px;
  font-weight: 600;
  color: #1a1a1a;
  letter-spacing: 0.3px;
}

.db-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #999;
  padding: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.db-modal-close:hover {
  background: #f5f5f5;
  color: #1a1a1a;
  transform: rotate(90deg);
}

.db-modal-body {
  padding: 28px;
}

.db-modal-footer {
  padding: 20px 28px;
  border-top: 1px solid #f0f0f0;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  background: #fafafa;
}

.db-input-group {
  margin-bottom: 20px;
}

.db-input-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  font-size: 13px;
  color: #1a1a1a;
  letter-spacing: 0.3px;
}

.db-form-control {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  font-size: 13px;
  background: #fafafa;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
  color: #1a1a1a;
}

.db-form-control:focus {
  outline: none;
  border-color: #1a1a1a;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.db-form-control:disabled {
  background: #f5f5f5;
  color: #999;
  cursor: not-allowed;
}

textarea.db-form-control {
  min-height: 220px;
  resize: vertical;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
  font-size: 12px;
  line-height: 1.7;
}

/* 响应式 */
@media (max-width: 768px) {
  .db-toolbar {
    flex-wrap: wrap;
    padding: 12px 16px;
  }

  .db-search-input {
    max-width: 100%;
    order: -1;
    flex-basis: 100%;
  }

  .db-select {
    min-width: 120px;
  }

  .db-table {
    font-size: 12px;
  }

  .db-table th,
  .db-table td {
    padding: 10px 14px;
  }

  .db-modal {
    margin: 16px;
    width: calc(100% - 32px);
    border-radius: 12px;
  }

  .db-modal-header,
  .db-modal-body,
  .db-modal-footer {
    padding: 20px;
  }
}

/* 图标动画 */
.db-btn i {
  transition: transform 0.2s ease;
}

.db-btn:hover i {
  transform: scale(1.1);
}

/* 空状态优化 */
.db-text-center i {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.3;
}