/* ================================
   通用卡片样式 - 适用于所有菜单的卡片
   ================================ */

/* 旋转动画 */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.spin {
    animation: spin 1s linear infinite;
}
.card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
  margin-bottom: 2rem;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.card-header {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
  color: white;
  border: none;
  border-radius: 16px 16px 0 0 !important;
  font-weight: 600;
  font-size: 1.1rem;
  padding: 1.25rem 1.5rem;
}

.card-body {
  padding: 1.5rem;
}

.btn {
  border-radius: 10px;
  font-weight: 500;
  transition: all 0.3s ease;
  padding: 0.5rem 1rem;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
  border: none;
}

.btn-success {
  background: linear-gradient(135deg, var(--success-color), #059669);
  border: none;
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger-color), #dc2626);
  border: none;
}

.btn-outline-primary {
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
}

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

.btn-outline-success {
  border: 2px solid var(--success-color);
  color: var(--success-color);
}

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

.btn-outline-info {
  border: 2px solid #0dcaf0;
  color: #0dcaf0;
}

.btn-outline-info:hover {
  background: #0dcaf0;
  border-color: #0dcaf0;
  color: white;
}

.btn-outline-danger {
  border: 2px solid var(--danger-color);
  color: var(--danger-color);
}

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

/* ================================
   通用表格样式 - 适用于所有菜单的表格
   ================================ */
.table {
  margin-bottom: 0;
  background: transparent;
}

.table th {
  border-top: none;
  border-bottom: 2px solid var(--border-color);
  font-weight: 600;
  color: var(--dark-color);
  background: rgba(79, 70, 229, 0.05);
  padding: 1rem;
}

.table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.table tbody tr:hover {
  background: rgba(79, 70, 229, 0.02);
}

.badge {
  font-weight: 500;
  padding: 5px 10px;
}

.form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.cookie-value {
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 0.85rem;
  background: #f8fafc;
  padding: 0.75rem;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  word-break: break-all;
  line-height: 1.4;
  max-height: 120px;
  overflow-y: auto;
  white-space: pre-wrap;
}

.loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(248, 250, 252, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  pointer-events: none;
}

.loading-spinner {
  width: 3rem;
  height: 3rem;
}

[data-theme="dark"] .loading {
  background-color: rgba(15, 23, 42, 0.45);
}

.keyword-editor {
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.modal-content {
  border-radius: 10px;
  border: none;
}

.modal-header {
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.modal-footer {
  border-top: 1px solid rgba(0,0,0,0.05);
}

.cookie-id {
  font-weight: 600;
  color: var(--primary-color);
  font-size: 1rem;
}

.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--secondary-color);
}

.empty-state i {
  opacity: 0.5;
}

.form-control, .form-select {
  border-radius: 10px;
  border: 2px solid var(--border-color);
  transition: all 0.3s ease;
  padding: 0.75rem 1rem;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
  transform: translateY(-1px);
}

.form-label {
  font-weight: 600;
  color: var(--dark-color);
  margin-bottom: 0.5rem;
}

/* ================================
   通用模态框样式 - 适用于所有菜单的模态框
   ================================ */
.modal-content {
  border: none;
  border-radius: 16px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(10px);
}

.modal-header {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
  color: white;
  border: none;
  border-radius: 16px 16px 0 0;
}

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
}

.toast {
  border: none;
  border-radius: 12px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(10px);
}

.btn-group .btn {
  margin-right: 0.25rem;
}

.btn-group .btn:last-child {
  margin-right: 0;
}

/* ================================
   AI回复配置 - 全量界面视觉增强
   ================================ */
#aiReplyConfigModal .modal-dialog {
  max-width: 900px;
}

#aiReplyConfigModal .ai-reply-content {
  overflow: hidden;
}

#aiReplyConfigModal .ai-reply-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

#aiReplyConfigModal .ai-reply-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#aiReplyConfigModal .ai-reply-subtitle {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.84);
}

#aiReplyConfigModal .ai-reply-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#aiReplyConfigModal .ai-modal-intro {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(79, 70, 229, 0.16);
  background: linear-gradient(120deg, rgba(99, 102, 241, 0.1), rgba(6, 182, 212, 0.1));
}

#aiReplyConfigModal .ai-intro-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(79, 70, 229, 0.16);
  color: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

#aiReplyConfigModal .ai-intro-title {
  font-weight: 700;
  color: var(--dark-color);
  line-height: 1.2;
}

#aiReplyConfigModal .ai-intro-text {
  font-size: 0.86rem;
  color: var(--secondary-color);
  margin-top: 2px;
}

#aiReplyConfigModal .ai-section-card {
  border-radius: 16px;
  overflow: hidden;
}

#aiReplyConfigModal .ai-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

#aiReplyConfigModal .ai-section-title {
  display: flex;
  flex-direction: column;
}

#aiReplyConfigModal .ai-section-desc {
  font-size: 0.76rem;
  opacity: 0.88;
}

#aiReplyConfigModal .ai-section-tag {
  font-size: 0.68rem;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.92);
}

#aiReplyConfigModal .ai-basic-card .card-body {
  background:
    radial-gradient(circle at right top, rgba(79, 70, 229, 0.09), transparent 45%),
    radial-gradient(circle at left bottom, rgba(6, 182, 212, 0.09), transparent 42%);
}

#aiReplyConfigModal .ai-basic-overview {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 12px;
}

#aiReplyConfigModal .ai-account-panel,
#aiReplyConfigModal .ai-enable-panel,
#aiReplyConfigModal .ai-config-block,
#aiReplyConfigModal .ai-config-grid {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(79, 70, 229, 0.14);
  border-radius: 14px;
  padding: 14px;
}

#aiReplyConfigModal .ai-account-field {
  display: flex;
  align-items: center;
  gap: 10px;
}

#aiReplyConfigModal .ai-account-field i {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
  color: #fff;
  font-size: 1rem;
  flex-shrink: 0;
}

#aiReplyConfigModal .ai-account-field .form-control {
  font-weight: 600;
}

#aiReplyConfigModal .ai-enable-panel {
  display: flex;
  align-items: center;
}

#aiReplyConfigModal .ai-enable-switch {
  margin: 0;
  width: 100%;
}

#aiReplyConfigModal .ai-enable-switch .form-check-input {
  width: 2.7rem;
  height: 1.4rem;
}

#aiReplyConfigModal .ai-config-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#aiReplyConfigModal .ai-preset-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

#aiReplyConfigModal .ai-preset-controls .form-select {
  flex: 1;
}

#aiReplyConfigModal .ai-preset-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

#aiReplyConfigModal .ai-config-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

#aiReplyConfigModal .ai-config-item {
  min-width: 0;
}

#aiReplyConfigModal .ai-config-item-wide {
  grid-column: 1 / -1;
}

#aiReplyConfigModal .ai-endpoint-preview {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px dashed rgba(16, 185, 129, 0.45);
  background: rgba(16, 185, 129, 0.07);
  color: #047857;
  font-family: 'SFMono-Regular', Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
  font-size: 0.82rem;
  line-height: 1.4;
  word-break: break-all;
  min-height: 34px;
}

#aiReplyConfigModal .ai-bargain-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

#aiReplyConfigModal .ai-metric-card {
  border-radius: 12px;
  border: 1px solid rgba(79, 70, 229, 0.14);
  background: rgba(255, 255, 255, 0.76);
  padding: 12px;
}

#aiReplyConfigModal .ai-prompt-tip {
  border-radius: 12px;
  border: 1px dashed rgba(14, 165, 233, 0.42);
  background: rgba(14, 165, 233, 0.08);
  color: #0369a1;
  font-size: 0.86rem;
  padding: 10px 12px;
}

#aiReplyConfigModal .ai-prompt-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

#aiReplyConfigModal .ai-prompt-card {
  border-radius: 12px;
  border: 1px solid rgba(79, 70, 229, 0.14);
  background: rgba(255, 255, 255, 0.76);
  padding: 12px;
}

#aiReplyConfigModal .ai-prompt-card-wide {
  grid-column: 1 / -1;
}

#aiReplyConfigModal .ai-prompt-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

#aiReplyConfigModal .ai-prompt-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

#aiReplyConfigModal .ai-prompt-dot-price {
  background: #f59e0b;
}

#aiReplyConfigModal .ai-prompt-dot-tech {
  background: #06b6d4;
}

#aiReplyConfigModal .ai-prompt-dot-default {
  background: #6366f1;
}

#aiReplyConfigModal .ai-prompt-textarea {
  height: 132px;
  min-height: 132px;
  resize: vertical;
}

#aiReplyConfigModal .ai-test-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

#aiReplyConfigModal .ai-test-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 2px;
}

#aiReplyConfigModal .ai-test-btn {
  min-width: 124px;
}

#aiReplyConfigModal .ai-test-result .alert {
  border-radius: 12px;
  border: 1px solid rgba(59, 130, 246, 0.28);
}

#aiReplyConfigModal .ai-reply-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

#aiReplyConfigModal .ai-footer-note {
  font-size: 0.82rem;
  color: var(--secondary-color);
}

#aiReplyConfigModal .ai-footer-actions {
  display: flex;
  gap: 8px;
}

@media (max-width: 768px) {
  #aiReplyConfigModal .ai-reply-header {
    align-items: center;
  }

  #aiReplyConfigModal .ai-reply-subtitle {
    display: none;
  }

  #aiReplyConfigModal .ai-modal-intro {
    padding: 10px 12px;
  }

  #aiReplyConfigModal .ai-bargain-grid,
  #aiReplyConfigModal .ai-prompt-grid,
  #aiReplyConfigModal .ai-test-grid,
  #aiReplyConfigModal .ai-basic-overview,
  #aiReplyConfigModal .ai-config-grid {
    grid-template-columns: 1fr;
  }

  #aiReplyConfigModal .ai-preset-controls {
    flex-direction: column;
    align-items: stretch;
  }

  #aiReplyConfigModal .ai-preset-actions {
    justify-content: flex-end;
  }

  #aiReplyConfigModal .ai-test-actions,
  #aiReplyConfigModal .ai-reply-footer {
    flex-direction: column;
    align-items: stretch;
  }

  #aiReplyConfigModal .ai-footer-actions {
    justify-content: flex-end;
  }
}

@media (max-width: 768px) {
  .container {
    margin-top: 1rem;
    padding: 0 1rem;
  }

  .card-body {
    padding: 1rem;
  }

  .btn {
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
  }

  .cookie-value {
    font-size: 0.75rem;
    max-height: 80px;
  }

  .btn-group {
    flex-direction: column;
  }

  .btn-group .btn {
    margin-right: 0;
    margin-bottom: 0.25rem;
  }

  /* 移动端商品表格优化 */
  #itemsTableBody .btn-group {
    flex-direction: row;
  }

  #itemsTableBody .btn-group .btn {
    padding: 0.2rem 0.4rem;
    font-size: 0.75rem;
  }
}

/* ================================
   API参数提示样式
   ================================ */
.param-item {
  display: flex;
  align-items: center;
  padding: 0.25rem 0;
}

.param-name {
  background-color: #f8f9fa;
  color: #495057;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid #dee2e6;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 120px;
  display: inline-block;
}

.param-name:hover {
  background-color: #e9ecef;
  border-color: #adb5bd;
  transform: translateY(-1px);
}

#postParamsHelp,
#editPostParamsHelp {
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 1rem;
}

#postParamsHelp .alert,
#editPostParamsHelp .alert {
  margin-bottom: 0;
  border-radius: 6px;
}

/* 参数项点击效果 */
.param-name:active {
  transform: translateY(0);
  background-color: #dee2e6;
}

/* ================================
   API参数提示样式
   ================================ */
.param-item {
  display: flex;
  align-items: center;
  padding: 0.25rem 0;
}

.param-name {
  background-color: #f8f9fa;
  color: #495057;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid #dee2e6;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 120px;
  display: inline-block;
}

.param-name:hover {
  background-color: #e9ecef;
  border-color: #adb5bd;
  transform: translateY(-1px);
}

#postParamsHelp,
#editPostParamsHelp {
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 1rem;
}

#postParamsHelp .alert,
#editPostParamsHelp .alert {
  margin-bottom: 0;
  border-radius: 6px;
}

/* 参数项点击效果 */
.param-name:active {
  transform: translateY(0);
  background-color: #dee2e6;
}

/* ================================
   菜单排序列表样式
   ================================ */
.menu-sort-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 500px;
  overflow-y: auto;
}

.menu-sort-item {
  display: flex;
  align-items: center;
  padding: 10px 15px;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  cursor: default;
  transition: all 0.2s ease;
}

.menu-sort-item:hover {
  background: #e9ecef;
}

.menu-sort-item.dragging {
  opacity: 0.5;
  background: #d1d5db;
  border-style: dashed;
}

.menu-sort-item.drag-over {
  border-color: var(--primary-color);
  background: rgba(79, 70, 229, 0.1);
}

.menu-sort-item .drag-handle {
  cursor: grab;
  padding: 5px 10px 5px 0;
  color: #6b7280;
  font-size: 1.2rem;
}

.menu-sort-item .drag-handle:active {
  cursor: grabbing;
}

.menu-sort-item .menu-icon {
  width: 24px;
  margin-right: 10px;
  color: var(--primary-color);
}

.menu-sort-item .menu-name {
  flex: 1;
  font-weight: 500;
}

.menu-sort-item .menu-checkbox {
  margin-left: 10px;
}

.menu-sort-item .badge {
  margin-left: 8px;
  font-size: 0.7rem;
}
