/* 关键词管理现代化样式 */
.keyword-container {
  background: white;
  border-radius: 16px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transition: all 0.3s ease;
}

.keyword-header {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
  color: white;
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.keyword-header h3 {
  margin: 0;
  font-weight: 600;
  display: flex;
  align-items: center;
}

.keyword-header .account-badge {
  background: rgba(255, 255, 255, 0.2);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 500;
}

.keyword-input-area {
  padding: 2rem;
  background: #f8fafc;
  border-bottom: 1px solid #e5e7eb;
}

.keyword-input-group {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.keyword-input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.keyword-btn-row {
  display: flex;
  gap: 0.75rem;
}

.input-field {
  position: relative;
}

.input-field label {
  position: absolute;
  top: -0.5rem;
  left: 0.75rem;
  background: #f8fafc;
  padding: 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: #6b7280;
  z-index: 1;
}

.input-field input, .input-field select, .input-field textarea {
  width: 100%;
  padding: 1rem 0.75rem 0.75rem;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  font-size: 0.875rem;
  transition: all 0.3s ease;
  background: white;
}

.input-field input:focus, .input-field select:focus, .input-field textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-field textarea {
  resize: vertical;
  font-family: inherit;
  line-height: 1.5;
}

/* 多选下拉框样式 */
.input-field select[multiple] {
  min-height: 120px;
  padding: 0.5rem;
}

.input-field select[multiple] option {
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  margin-bottom: 4px;
  cursor: pointer;
}

.input-field select[multiple] option:hover {
  background-color: #f3f4f6;
}

.input-field select[multiple] option:checked {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-weight: 500;
}

.add-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 1rem 1.5rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.add-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.3);
}

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

/* ================================
   【自动回复菜单】相关样式
   ================================ */
.keywords-list {
  padding: 1.5rem 2rem 2rem;
  max-height: 500px;
  overflow-y: auto;
}

.keyword-item {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  margin-bottom: 1rem;
  transition: all 0.3s ease;
  overflow: hidden;
}

.keyword-item:hover {
  border-color: #667eea;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
  transform: translateY(-1px);
}

.keyword-item-header {
  padding: 1rem 1.5rem;
  background: #f8fafc;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.keyword-tag {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.keyword-actions {
  display: flex;
  gap: 0.5rem;
}

.action-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.edit-btn {
  background: #f3f4f6;
  color: #6b7280;
}

.edit-btn:hover {
  background: #e5e7eb;
  color: #374151;
}

.edit-btn-disabled {
  background: #f9fafb !important;
  color: #9ca3af !important;
  cursor: not-allowed !important;
}

.edit-btn-disabled:hover {
  background: #f9fafb !important;
  color: #9ca3af !important;
}

.delete-btn {
  background: #fef2f2;
  color: #ef4444;
}

.delete-btn:hover {
  background: #fee2e2;
  color: #dc2626;
}

.keyword-content {
  padding: 1.5rem;
}

.reply-text {
  color: #374151;
  line-height: 1.6;
  margin: 0;
  font-size: 0.875rem;
}

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: #6b7280;
}

.empty-state i {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state h3 {
  margin: 0 0 0.5rem;
  color: #374151;
}

.empty-state p {
  margin: 0 0 2rem;
  font-size: 0.875rem;
}

.quick-add-btn {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 0.75rem 1.5rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.quick-add-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

/* 账号选择器现代化 */
.account-selector {
  background: white;
  border-radius: 16px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  padding: 2rem;
  margin-bottom: 2rem;
}

.selector-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.selector-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.25rem;
}

.selector-title {
  margin: 0;
  color: #1f2937;
  font-weight: 600;
}

.selector-subtitle {
  margin: 0;
  color: #6b7280;
  font-size: 0.875rem;
}

.account-select-wrapper {
  position: relative;
}

.account-select {
  width: 100%;
  padding: 1rem 1.25rem;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  font-size: 1rem;
  background: white;
  cursor: pointer;
  transition: all 0.3s ease;
}

.account-select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* ================================
   【自动回复菜单】图片关键词样式
   ================================ */
.btn-image {
  background: linear-gradient(135deg, #28a745, #20c997) !important;
  border: none !important;
  margin-left: 10px;
}

.btn-image:hover {
  background: linear-gradient(135deg, #218838, #1ea085) !important;
  transform: translateY(-1px);
}

.keyword-input-group .add-btn {
  white-space: nowrap;
  min-width: auto;
}

.image-preview {
  margin-top: 10px;
}

.preview-container {
  padding: 10px;
  border: 2px dashed #ddd;
  border-radius: 8px;
  text-align: center;
  background-color: #f8f9fa;
}

.keyword-type-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  margin-left: 8px;
}

.keyword-type-text {
  background-color: #e3f2fd;
  color: #1976d2;
}

.keyword-type-image {
  background-color: #f3e5f5;
  color: #7b1fa2;
}

/* 关键词列表中的图片预览 */
.keyword-image-preview {
  max-width: 60px;
  max-height: 60px;
  border-radius: 4px;
  border: 1px solid #ddd;
  cursor: pointer;
}

.keyword-image-preview:hover {
  border-color: #007bff;
  transform: scale(1.05);
  transition: all 0.2s ease;
}

/* ================================
   【关键词分组显示】新样式
   ================================ */
.keyword-group-item {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  transition: all 0.3s ease;
  overflow: hidden;
}

.keyword-group-item:hover {
  border-color: #667eea;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.keyword-group-header {
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.keyword-group-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
  color: #1f2937;
}

.keyword-count-badge {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
}

.keyword-group-reply {
  padding: 1rem 1.5rem;
  background: #fefce8;
  border-bottom: 1px solid #fef08a;
  font-size: 0.9rem;
}

.keyword-group-reply strong {
  color: #854d0e;
  margin-right: 0.5rem;
}

.reply-text-content {
  color: #374151;
  font-weight: 500;
}

.keyword-group-content {
  padding: 1.5rem;
}

.keyword-section, .item-section {
  margin-bottom: 1.25rem;
}

.keyword-section:last-child, .item-section:last-child {
  margin-bottom: 0;
}

.section-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.keyword-chip, .item-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%);
  color: #5b21b6;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.keyword-chip:hover, .item-chip:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(91, 33, 182, 0.2);
}

.item-chip {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  color: #1e40af;
  max-width: 400px;
}

.item-chip:hover {
  box-shadow: 0 4px 8px rgba(30, 64, 175, 0.2);
}

.chip-remove-btn {
  background: rgba(0, 0, 0, 0.1);
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
  color: inherit;
}

.chip-remove-btn:hover {
  background: rgba(0, 0, 0, 0.2);
  transform: scale(1.1);
}

.chip-remove-btn i {
  font-size: 0.875rem;
  font-weight: bold;
}

/* 回复内容编辑按钮 */
.reply-edit-btn {
  background: none;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: 0.75rem;
  flex-shrink: 0;
}

.reply-edit-btn:hover {
  background: #f3f4f6;
  color: #374151;
  border-color: #9ca3af;
}

.reply-edit-area {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  margin-top: 0.5rem;
}

.reply-edit-textarea {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #667eea;
  border-radius: 8px;
  font-size: 0.875rem;
  font-family: inherit;
  line-height: 1.5;
  resize: vertical;
  min-height: 60px;
  background: white;
  color: #374151;
  transition: border-color 0.2s ease;
}

.reply-edit-textarea:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.reply-edit-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.reply-save-btn, .reply-cancel-btn {
  padding: 0.375rem 0.75rem;
  border: none;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.reply-save-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
}

.reply-save-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
}

.reply-cancel-btn {
  background: #f3f4f6;
  color: #6b7280;
}

.reply-cancel-btn:hover {
  background: #e5e7eb;
  color: #374151;
}

/* ================================
   暗色模式适配 - 关键词管理
   ================================ */
[data-theme="dark"] .keyword-container {
  background: var(--card-bg);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .keyword-input-area {
  background: var(--bg-secondary);
  border-bottom-color: var(--border-color);
}

[data-theme="dark"] .input-field label {
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

[data-theme="dark"] .input-field input,
[data-theme="dark"] .input-field select,
[data-theme="dark"] .input-field textarea {
  background: var(--input-bg);
  border-color: var(--input-border);
  color: var(--text-color);
}

[data-theme="dark"] .input-field input:focus,
[data-theme="dark"] .input-field select:focus,
[data-theme="dark"] .input-field textarea:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

[data-theme="dark"] .input-field input::placeholder,
[data-theme="dark"] .input-field textarea::placeholder {
  color: var(--text-secondary);
}

[data-theme="dark"] .input-field select[multiple] option {
  background: var(--input-bg);
  color: var(--text-color);
}

[data-theme="dark"] .input-field select[multiple] option:hover {
  background-color: var(--bg-secondary);
}

[data-theme="dark"] .input-field select[multiple] option:checked {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

/* 暗色 - 关键词列表 */
[data-theme="dark"] .keyword-item {
  background: var(--card-bg);
  border-color: var(--border-color);
}

[data-theme="dark"] .keyword-item-header {
  background: var(--bg-secondary);
  border-bottom-color: var(--border-color);
}

[data-theme="dark"] .keyword-content {
  background: var(--card-bg);
}

[data-theme="dark"] .reply-text {
  color: var(--text-color);
}

/* 暗色 - 关键词分组 */
[data-theme="dark"] .keyword-group-item {
  background: var(--card-bg);
  border-color: var(--border-color);
}

[data-theme="dark"] .keyword-group-header {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--input-bg) 100%);
  border-bottom-color: var(--border-color);
}

[data-theme="dark"] .keyword-group-title {
  color: var(--text-color);
}

[data-theme="dark"] .keyword-group-reply {
  background: rgba(133, 77, 14, 0.15);
  border-bottom-color: rgba(254, 240, 138, 0.2);
}

[data-theme="dark"] .keyword-group-reply strong {
  color: #fcd34d;
}

[data-theme="dark"] .reply-text-content {
  color: var(--text-color);
}

[data-theme="dark"] .keyword-group-content {
  background: var(--card-bg);
}

[data-theme="dark"] .section-title {
  color: var(--text-secondary);
}

/* 暗色 - Chips */
[data-theme="dark"] .keyword-chip {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.25) 0%, rgba(124, 58, 237, 0.25) 100%);
  color: #c4b5fd;
}

[data-theme="dark"] .keyword-chip:hover {
  box-shadow: 0 4px 8px rgba(139, 92, 246, 0.3);
}

[data-theme="dark"] .item-chip {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.25) 0%, rgba(37, 99, 235, 0.25) 100%);
  color: #93c5fd;
}

[data-theme="dark"] .item-chip:hover {
  box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

[data-theme="dark"] .chip-remove-btn {
  background: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .chip-remove-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* 暗色 - 操作按钮 */
[data-theme="dark"] .edit-btn {
  background: var(--input-bg);
  color: var(--text-color);
}

[data-theme="dark"] .edit-btn:hover {
  background: var(--border-color);
}

[data-theme="dark"] .delete-btn {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

[data-theme="dark"] .delete-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #f87171;
}

/* 暗色 - 空状态 */
[data-theme="dark"] .empty-state {
  color: var(--text-secondary);
}

[data-theme="dark"] .empty-state h3 {
  color: var(--text-color);
}

/* 暗色 - 账号选择器 */
[data-theme="dark"] .account-selector {
  background: var(--card-bg);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .selector-title {
  color: var(--text-color);
}

[data-theme="dark"] .selector-subtitle {
  color: var(--text-secondary);
}

[data-theme="dark"] .account-select {
  background: var(--input-bg);
  border-color: var(--input-border);
  color: var(--text-color);
}

[data-theme="dark"] .account-select:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

/* 暗色 - 图片预览 */
[data-theme="dark"] .preview-container {
  background-color: var(--bg-secondary);
  border-color: var(--border-color);
}

[data-theme="dark"] .keyword-image-preview {
  border-color: var(--border-color);
}

[data-theme="dark"] .keyword-image-preview:hover {
  border-color: #667eea;
}

/* 暗色 - 类型徽章 */
[data-theme="dark"] .keyword-type-text {
  background-color: rgba(25, 118, 210, 0.2);
  color: #93c5fd;
}

[data-theme="dark"] .keyword-type-image {
  background-color: rgba(123, 31, 162, 0.2);
  color: #d8b4fe;
}

/* 暗色 - 回复编辑 */
[data-theme="dark"] .reply-edit-btn {
  border-color: var(--border-color);
  color: var(--text-secondary);
}

[data-theme="dark"] .reply-edit-btn:hover {
  background: var(--input-bg);
  color: var(--text-color);
  border-color: var(--text-secondary);
}

[data-theme="dark"] .reply-edit-textarea {
  background: var(--input-bg);
  border-color: #667eea;
  color: var(--text-color);
}

[data-theme="dark"] .reply-edit-textarea:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

[data-theme="dark"] .reply-cancel-btn {
  background: var(--input-bg);
  color: var(--text-secondary);
}

[data-theme="dark"] .reply-cancel-btn:hover {
  background: var(--border-color);
  color: var(--text-color);
}

/* 暗色 - Modal 内关键词样式 */
[data-theme="dark"] .modal .input-field input,
[data-theme="dark"] .modal .input-field textarea {
  background: var(--input-bg);
  border-color: var(--input-border);
  color: var(--text-color);
}

/* 响应式调整 */
@media (max-width: 768px) {
  .keyword-input-row {
    grid-template-columns: 1fr;
  }

  .keyword-btn-row {
    flex-direction: column;
  }

  .keyword-item-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .keyword-actions {
    align-self: flex-end;
  }

  .keyword-input-group {
    flex-direction: column;
    align-items: stretch;
  }

  .keyword-input-group .add-btn {
    margin-left: 0;
    margin-top: 10px;
  }
  
  .keyword-group-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .chips-container {
    gap: 0.375rem;
  }
  
  .keyword-chip, .item-chip {
    font-size: 0.8125rem;
    padding: 0.375rem 0.625rem;
  }
  
  .item-chip {
    max-width: 100%;
  }
}
