.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  backdrop-filter: blur(5px);
}

.edit-modal {
  background: #fff;
  border-radius: var(--border-radius);
  width: 90%;
  max-width: 500px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalFadeIn 0.3s ease;
  border: none;
}

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

.edit-modal .modal-header {
  background: linear-gradient(
    to right,
    var(--primary-color),
    var(--secondary-color)
  );
  color: white;
  padding: 0.75rem 1.25rem;
  border-bottom: none;
}

.edit-modal .modal-header h5 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: white;
  display: flex;
  align-items: center;
}

.edit-modal .modal-header .modal-close {
  opacity: 0.8;
  color: white;
  font-size: 1.5rem;
  filter: invert(1) brightness(2);
}

.edit-modal .modal-body {
  padding: 1.25rem;
  max-height: none;
  overflow-y: visible;
}

.edit-modal .modal-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid #eaecef;
  background-color: #fff;
}

.edit-modal .form-control,
.edit-modal .form-select {
  border-radius: var(--border-radius);
  border: 1px solid #eaecef;
  transition: var(--transition-base);
  padding: 0.5rem 0.75rem;
  height: auto;
  font-size: var(--font-size-sm);
}

.edit-modal textarea.form-control {
  min-height: 60px;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  resize: vertical;
}

.edit-modal .form-control:focus,
.edit-modal .form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(112, 73, 240, 0.1);
}

.edit-modal .form-label {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.4rem;
  color: var(--primary-color);
  position: relative;
  display: inline-block;
  padding-left: 8px;
}

.edit-modal .form-label::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 3px;
  background: var(--primary-gradient);
  border-radius: 2px;
}

/* 调整表单元素之间的间距 */
.edit-modal .row.g-3 {
  row-gap: 0.7rem !important;
}

.edit-modal .form-select {
  border-radius: var(--border-radius);
  border: 1px solid #eaecef;
  padding: 0.5rem 0.75rem;
  font-size: var(--font-size-sm);
  height: auto;
  background-color: #fff;
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%237049f0' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 16px 12px;
  transition: var(--transition-base);
}

.edit-modal .form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem rgba(112, 73, 240, 0.25);
}

.edit-modal .modal-close {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
  padding: 0.25rem;
  opacity: 0.5;
  transition: opacity 0.2s;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-md) var(--spacing-md);
  border-bottom: 1px solid #eee;
}

.modal-header h4 {
  margin: 0;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  background: transparent;
  border: none;
  font-size: var(--font-size-xl);
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition-base);
}

.modal-close:hover {
  color: var(--primary-color);
}

.modal-body {
  padding: var(--spacing-md);
}

.form-group {
  margin-bottom: var(--spacing-sm);
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  font-weight: 500;
}

.modal-input {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-sm);
  border: 1px solid #ddd;
  border-radius: var(--border-radius);
  font-size: var(--font-size-sm);
  transition: var(--transition-base);
  box-sizing: border-box;
  line-height: 1.5;
}

textarea.modal-input {
  min-height: 120px;
  resize: vertical;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: inherit;
}

.modal-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(112, 73, 240, 0.1);
  outline: none;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: var(--spacing-md);
  gap: var(--spacing-sm);
}

.modal-btn {
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: var(--font-size-sm);
  font-weight: 500;
  border: none;
  transition: var(--transition-base);
}

.modal-btn.cancel {
  background: var(--bg-primary);
  color: var(--text-primary);
}

.modal-btn.cancel:hover {
  background: #e5e5e5;
}

.modal-btn.save {
  background: var(--primary-gradient);
  color: white;
}

.modal-btn.save:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.url-input-group {
  position: relative;
  display: flex;
}

.icon-fetch-btn {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: var(--border-radius);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-fetch-btn:hover {
  color: var(--primary-color);
  background-color: var(--bg-hover);
}

.icon-fetch-btn.loading i {
  animation: spin 1s linear infinite !important;
  display: inline-block !important;
}

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

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background-color: #fff;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 600px;
  max-height: calc(100vh - 40px);
  margin: 20px;
  position: relative;
  animation: modalFadeIn 0.3s ease;
  border: none;
}

.modal-footer {
  padding: 1rem;
  border-top: 1px solid #dee2e6;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.modal-input {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-sm);
  border: 1px solid #ddd;
  border-radius: var(--border-radius);
  font-size: var(--font-size-sm);
  transition: var(--transition-base);
  box-sizing: border-box;
  line-height: 1.5;
}

textarea.modal-input {
  min-height: 120px;
  resize: vertical;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: inherit;
}

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

/* 快速添加对话框样式 */
.quick-add-modal {
  max-width: 500px;
  overflow: hidden;
}

.quick-add-modal .modal-body {
  padding: 1.25rem;
}

.quick-add-modal .form-control,
.quick-add-modal .form-select {
  border-radius: var(--border-radius);
  border: 1px solid #eaecef;
  transition: var(--transition-base);
  padding: 0.5rem 0.75rem;
  height: auto;
  font-size: var(--font-size-sm);
}

.quick-add-modal textarea.form-control {
  min-height: 60px;
  resize: vertical;
}

.quick-add-modal .form-control:focus,
.quick-add-modal .form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(112, 73, 240, 0.1);
}

.quick-add-modal .form-label {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.4rem;
  color: var(--primary-color);
  position: relative;
  display: inline-block;
  padding-left: 8px;
}

.quick-add-modal .form-label::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 3px;
  background: var(--primary-gradient);
  border-radius: 2px;
}

/* 优化下拉菜单的hover效果 */
.quick-add-modal .form-select option:hover,
.quick-add-modal .form-select option:focus,
.quick-add-modal .form-select option:active,
.quick-add-modal .form-select option.highlighted {
  background-color: rgba(112, 73, 240, 0.1) !important;
  color: var(--primary-color) !important;
}

.category-select-container {
  position: relative;
}

/* 分类选择器样式优化 */
.category-select-container .form-select {
  color: var(--text-primary);
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 16px 12px;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%237049f0' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
}

.category-select-container .form-select:focus {
  border-color: var(--primary-color);
}

/* 修改选择框的背景色 */
.form-select option {
  padding: 8px 12px;
}

.quick-add-modal .modal-header {
  background: linear-gradient(
    to right,
    var(--primary-color),
    var(--secondary-color)
  );
  color: white;
  padding: 0.75rem 1.25rem;
  border-bottom: none;
}

.quick-add-modal .modal-header h5 {
  font-weight: 600;
}

.quick-add-modal .modal-header .btn-close {
  filter: invert(1) brightness(2);
  opacity: 0.8;
}

.quick-add-modal .modal-footer {
  border-top: 1px solid #eaecef;
  padding: 0.75rem 1.25rem;
}

.quick-add-modal .btn-primary {
  background: var(--primary-gradient);
  border: none;
  font-weight: 500;
  transition: all 0.2s ease;
}

.quick-add-modal .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(112, 73, 240, 0.2);
}

.quick-add-modal .btn-outline-secondary {
  color: var(--text-primary);
  border-color: #eaecef;
  font-weight: 500;
}

.quick-add-modal .btn-outline-secondary:hover {
  background-color: #f5f7fa;
}

/* 调整单选按钮组样式 */
.edit-modal .form-check {
  margin-top: -0.25rem;
  margin-bottom: 0;
}

.edit-modal .form-check-input {
  margin-top: 0.3rem;
}

.edit-modal .btn-primary {
  background: var(--primary-gradient);
  border: none;
  font-weight: 500;
  transition: all 0.2s ease;
}

.edit-modal .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(112, 73, 240, 0.2);
}

.edit-modal .btn-outline-secondary {
  color: var(--text-primary);
  border-color: #eaecef;
  font-weight: 500;
}

.edit-modal .btn-outline-secondary:hover {
  background-color: #f5f7fa;
}

/* 调整编辑模态框中列元素的间距 */
.edit-modal .col-md-12 {
  margin-top: 0.5rem;
}

.edit-modal .col-md-12:first-child {
  margin-top: 0;
}

.btn-outline-secondary.loading i {
  animation: spin 1s linear infinite;
}

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

/* 移除按钮边框样式 */
.input-group .btn-outline-secondary {
  border: none;
  background: transparent;
  outline: none;
  box-shadow: none;
  padding-left: 8px;
  padding-right: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6c757d;
}

.input-group .btn-outline-secondary:hover,
.input-group .btn-outline-secondary:focus,
.input-group .btn-outline-secondary:active {
  border: none;
  background: transparent;
  box-shadow: none;
  color: var(--primary-color);
}

/* 重复链接提醒对话框样式 */
.duplicate-alert {
  padding: 0.5rem 0;
}

.duplicate-info {
  background-color: rgba(0, 0, 0, 0.03);
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0;
  border-left: 4px solid var(--primary-color);
}

.info-item {
  display: flex;
  align-items: flex-start;
  margin-bottom: 0.5rem;
  line-height: 1.5;
}

.info-item:last-child {
  margin-bottom: 0;
}

.info-item i {
  margin-right: 0.5rem;
  min-width: 1.2rem;
  padding-top: 0.2rem;
}

.info-item span {
  margin-right: 0.3rem;
  color: var(--text-secondary);
}

#duplicateDesc {
  display: inline-block;
  max-height: 60px;
  overflow-y: auto;
  color: var(--text-primary);
}

/* 修改底部按钮样式，确保一致性 */
#viewExistingLink {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

#viewExistingLink:hover {
  background-color: #5d3fd3;
  border-color: #5d3fd3;
  color: white;
  box-shadow: 0 0 0 0.2rem rgba(112, 73, 240, 0.25);
}

#addDuplicateLink {
  background-color: #ff9800;
  border-color: #ff9800;
  color: white;
}

#addDuplicateLink:hover {
  background-color: #f57c00;
  border-color: #f57c00;
}

/* 自定义确认对话框样式 */
.confirm-dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.2s ease;
}

.confirm-dialog {
  background-color: white;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  width: 100%;
  max-width: 400px;
  overflow: hidden;
  animation: slideUp 0.3s ease;
}

.confirm-dialog-header {
  padding: 15px 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
}

.confirm-dialog-header i {
  font-size: 24px;
  margin-right: 12px;
  color: #e53935;
}

.confirm-dialog-title {
  font-size: 18px;
  font-weight: 600;
  color: #333;
}

.confirm-dialog-body {
  padding: 20px;
  font-size: 15px;
  color: #555;
  line-height: 1.5;
}

.confirm-dialog-footer {
  padding: 12px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.confirm-btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.confirm-btn-cancel {
  background-color: #f5f5f5;
  color: #555;
}

.confirm-btn-cancel:hover {
  background-color: #eee;
}

.confirm-btn-confirm {
  background: var(
    --primary-gradient,
    linear-gradient(135deg, #7049f0, #aa26ff)
  );
  color: white;
}

.confirm-btn-confirm:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.confirm-btn-danger {
  background: linear-gradient(145deg, #f44336, #e53935);
  color: white;
}

.confirm-btn-danger:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

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

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

/* 表单加载状态样式 */
.form-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  z-index: 10;
  border-radius: var(--border-radius);
  backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.form-loading-overlay.show {
  opacity: 1;
  visibility: visible;
}

.form-loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(112, 73, 240, 0.2);
  border-radius: 50%;
  border-top-color: var(--primary-color, #7049f0);
  animation: spin 1s linear infinite;
  margin-bottom: 12px;
}

.form-loading-text {
  color: var(--primary-color, #7049f0);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  max-width: 80%;
  line-height: 1.4;
  background-color: rgba(255, 255, 255, 0.8);
  padding: 6px 12px;
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

/* 修复快速添加链接弹窗访问权限字体颜色 */
.quick-add-modal .form-check-label {
  color: var(--text-primary) !important;
}
