/*

This CSS file will be included with your plugin, and
available in the app when your plugin is enabled.

If your plugin does not need CSS, delete this file.

*/

/* Settings Page Styles */
.discourse-config-section {
  margin: 20px 0;
  padding: var(--size-4-4);
  border: 1px solid var(--background-modifier-border);
  border-radius: var(--radius-m);
  background: var(--background-secondary);
}

.discourse-config-section h2 {
  margin: 0 0 var(--size-2-3) 0;
  color: var(--text-accent);
  border-bottom: 2px solid var(--interactive-accent);
  padding-bottom: var(--size-2-1);
  font-size: var(--font-text-size);
  font-weight: var(--font-weight-bold);
}

.discourse-step {
  margin: var(--size-2-3) 0;
  padding: var(--size-2-3);
  border-left: 3px solid var(--interactive-accent);
  background: var(--background-primary);
  border-radius: 0 var(--radius-s) var(--radius-s) 0;
}

.discourse-step-title {
  font-weight: var(--font-weight-bold);
  color: var(--text-accent);
  margin-bottom: var(--size-2-1);
  font-size: var(--font-ui-small);
}

.discourse-step-description {
  color: var(--text-muted);
  font-size: var(--font-ui-smaller);
  margin-bottom: var(--size-2-2);
}

/* Basic Modal Style Override */
.modal.mod-discourse-sync {
  max-width: 500px;
  max-height: 90vh;
  background-color: var(--background-primary);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--background-modifier-border);
}

/* Content Area Style */
.discourse-sync-modal {
  padding: 24px;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

/* Form Area */
.discourse-sync-modal .form-area {
  flex-grow: 1;
  min-height: 0;
  margin-bottom: 16px;
}

/* Button Area Fixed at Bottom */
.discourse-sync-modal .button-area {
  flex-shrink: 0;
  margin-top: auto;
}

.discourse-sync-modal h1 {
  margin: 0 0 24px 0;
  font-size: 1.5em;
  font-weight: 600;
  color: var(--text-normal);
}

/* Common Form Container Style */
.discourse-sync-modal .select-container,
.discourse-sync-modal .tag-container {
  margin-bottom: 24px;
  padding: 0;  /* Remove padding */
}

.discourse-sync-modal .select-container label,
.discourse-sync-modal .tag-container label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text-normal);
}

/* Input and Selector Style */
.discourse-sync-modal select,
.discourse-sync-modal .tag-select-area {
  width: 100%;
  padding: 8px 12px;
  border: 2px solid var(--background-modifier-border);
  border-radius: var(--radius-s);
  background-color: var(--background-primary);
  color: var(--text-normal);
  font-size: 14px;
  min-height: 42px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.discourse-sync-modal select {
  height: 42px;
  line-height: 1.5;
  cursor: pointer;
}

.discourse-sync-modal select:hover {
  border-color: var(--background-modifier-border-hover);
}

.discourse-sync-modal select:focus {
  border-color: var(--interactive-accent) !important;
  outline: none;
  box-shadow: 0 0 0 2px var(--interactive-accent-hover);
}

.discourse-sync-modal .submit-button {
  width: 100%;
  padding: 10px 16px;
  border-radius: var(--radius-m);
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.2s ease;
  /* 确保按钮有合适的尺寸和阴影 */
  min-height: 42px;
  box-shadow: var(--shadow-s);
}

/* 确保按钮在所有主题下都可见 */
.discourse-sync-modal .submit-button {
  /* 强制设置具体的样式值，避免被主题覆盖 */
  background-color: var(--interactive-accent) !important;
  color: var(--text-on-accent) !important;
  border: 1px solid var(--interactive-accent) !important;
  /* 确保按钮有足够的对比度 */
  filter: contrast(1.1) saturate(1.1);
}

.discourse-sync-modal .submit-button:hover {
  background-color: var(--interactive-accent-hover) !important;
  border-color: var(--interactive-accent-hover) !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15) !important;
}

.discourse-sync-modal .submit-button:disabled {
  background-color: var(--background-modifier-border) !important;
  color: var(--text-muted) !important;
  border-color: var(--background-modifier-border) !important;
  opacity: 1 !important;
  filter: none;
  cursor: not-allowed !important;
}

/* 这些规则已经被上面的 !important 规则覆盖了，移除重复 */



/* Tag Select Area Style */
.discourse-sync-modal .tag-select-area {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}

.discourse-sync-modal .selected-tags {
  display: none;  /* Hidden by default */
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
  min-height: 28px;
}

.discourse-sync-modal .selected-tags:not(:empty) {
  display: flex;  /* Show when has content */
}

.discourse-sync-modal .tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background-color: var(--interactive-accent);
  color: var(--text-on-accent);
  border-radius: var(--radius-s);
  font-size: 12px;
  font-weight: 500;
  transition: all 0.2s ease;
  border: 1px solid var(--interactive-accent);
}

.discourse-sync-modal .tag:hover {
  background-color: var(--interactive-accent-hover);
  border-color: var(--interactive-accent-hover);
}

.discourse-sync-modal .remove-tag {
  cursor: pointer;
  font-size: 14px;
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background-color: var(--background-modifier-hover);
  margin-left: 4px;
  transition: all 0.2s ease;
  opacity: 0.7;
}

.discourse-sync-modal .remove-tag:hover {
  background-color: var(--background-modifier-error);
  color: var(--text-on-accent);
  opacity: 1;
  transform: scale(1.1);
}

.discourse-sync-modal input[type="text"] {
  width: 100%;
  padding: 8px;
  border: none;
  background: transparent;
  color: var(--text-normal);
  font-size: 14px;
  outline: none;
  transition: background-color 0.2s ease;
}

.discourse-sync-modal input[type="text"]:focus {
  background-color: var(--background-modifier-hover);
  border-radius: var(--radius-s);
}

.discourse-sync-modal input[type="text"]::placeholder {
  color: var(--text-muted);
  opacity: 0.8;
}

.discourse-sync-modal .suggestions-container {
  max-height: 250px;
  overflow-y: auto;
  border-bottom: 1px solid var(--background-modifier-border);
}

/* Tag Input Container */
.discourse-sync-modal .tag-input-container {
  position: relative;
  width: 100%;
}

/* Tag Suggestion Dropdown */
.discourse-sync-modal .tag-suggestions {
  position: fixed;
  background-color: var(--background-primary);
  border: 1px solid var(--background-modifier-border);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-l);
  z-index: 1001;
  max-height: 180px;
  overflow-y: auto;
  margin-top: 4px;
  display: none;  /* Hidden by default */
  backdrop-filter: blur(8px);
}

.discourse-sync-modal .tag-suggestions:not(:empty) {
  display: block;  /* Show when has content */
}

/* Tag Suggestion Item */
.discourse-sync-modal .tag-suggestion {
  padding: 8px 12px;
  cursor: pointer;
  color: var(--text-normal);
  font-size: 14px;
  display: flex;
  align-items: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background-color: var(--background-primary);
  transition: all 0.2s ease;
  border-radius: var(--radius-s);
  margin: 2px 4px;
}

.discourse-sync-modal .tag-suggestion:hover {
  background-color: var(--background-modifier-hover);
  color: var(--text-accent);
  transform: translateX(2px);
}

.discourse-sync-modal .tag-suggestion:active {
  background-color: var(--interactive-accent);
  color: var(--text-on-accent);
}

/* Tag Suggestion Scrollbar Style */
.discourse-sync-modal .tag-suggestions::-webkit-scrollbar {
  width: 6px;
}

.discourse-sync-modal .tag-suggestions::-webkit-scrollbar-track {
  background: var(--background-secondary);
  border-radius: var(--radius-s);
}

.discourse-sync-modal .tag-suggestions::-webkit-scrollbar-thumb {
  background-color: var(--background-modifier-border);
  border-radius: var(--radius-s);
  transition: background-color 0.2s ease;
}

.discourse-sync-modal .tag-suggestions::-webkit-scrollbar-thumb:hover {
  background-color: var(--interactive-accent);
}

/* Remove tag-container z-index to avoid interference */
.discourse-sync-modal .tag-container {
  position: relative;
}



@keyframes fadeInOut {
  0% {
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

/* Category Conflict Modal Styles */
.discourse-category-conflict-modal {
  padding: 24px;
  max-width: 600px;
  background-color: var(--background-primary);
  border-radius: var(--radius-l);
}

.discourse-category-conflict-modal h2 {
  margin: 0 0 16px 0;
  font-size: 1.4em;
  font-weight: 600;
  color: var(--text-normal);
  text-align: center;
}

.discourse-category-conflict-modal .conflict-description {
  margin-bottom: 24px;
  text-align: center;
}

.discourse-category-conflict-modal .conflict-description p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.5;
}

.discourse-category-conflict-modal .category-comparison {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}

.discourse-category-conflict-modal .category-option {
  flex: 1;
  padding: 16px;
  border: 2px solid var(--background-modifier-border);
  border-radius: var(--radius-m);
  text-align: center;
  background-color: var(--background-secondary);
}

.discourse-category-conflict-modal .category-option.local {
  border-color: var(--color-blue);
  background-color: var(--color-blue-hover);
}

.discourse-category-conflict-modal .category-option.remote {
  border-color: var(--color-orange);
  background-color: var(--color-orange-hover);
}

.discourse-category-conflict-modal .category-option h3 {
  margin: 0 0 8px 0;
  font-size: 1.1em;
  font-weight: 600;
  color: var(--text-normal);
}

.discourse-category-conflict-modal .category-name {
  font-size: 14px;
  color: var(--text-muted);
  word-break: break-all;
}

.discourse-category-conflict-modal .button-area {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.discourse-category-conflict-modal .keep-local-button,
.discourse-category-conflict-modal .use-remote-button {
  flex: 1;
  max-width: 180px;
  padding: 10px 16px;
  border-radius: var(--radius-m);
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.2s ease;
  min-height: 42px;
  box-shadow: var(--shadow-s);
}

.discourse-category-conflict-modal .keep-local-button {
  background-color: var(--color-blue);
  color: white;
  border: 1px solid var(--color-blue);
}

.discourse-category-conflict-modal .keep-local-button:hover {
  background-color: var(--color-blue-hover);
  border-color: var(--color-blue-hover);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.discourse-category-conflict-modal .use-remote-button {
  background-color: var(--color-orange);
  color: white;
  border: 1px solid var(--color-orange);
}

.discourse-category-conflict-modal .use-remote-button:hover {
  background-color: var(--color-orange-hover);
  border-color: var(--color-orange-hover);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* 响应式设计 */
@media (max-width: 600px) {
  .discourse-category-conflict-modal .category-comparison {
    flex-direction: column;
  }
  
  .discourse-category-conflict-modal .button-area {
    flex-direction: column;
  }
  
  .discourse-category-conflict-modal .keep-local-button,
  .discourse-category-conflict-modal .use-remote-button {
    max-width: none;
  }
}

/* Update Notice Modal Styles */
.discourse-update-notice-modal {
  padding: var(--size-4-4);
  max-width: 500px;
  background-color: var(--background-primary);
  border-radius: var(--radius-l);
}

.discourse-update-notice-modal .update-notice-title {
  margin: 0 0 var(--size-2-3) 0;
  font-size: var(--font-text-size);
  font-weight: var(--font-weight-bold);
  color: var(--text-accent);
  text-align: center;
}

.discourse-update-notice-modal .update-notice-message {
  margin-bottom: var(--size-4-4);
  text-align: left;
}

.discourse-update-notice-modal .update-notice-message p {
  margin: 0;
  color: var(--text-normal);
  line-height: var(--line-height-normal);
  font-size: var(--font-ui-medium);
}

.discourse-update-notice-modal .update-notice-buttons {
  display: flex;
  gap: var(--size-2-3);
  justify-content: center;
}

.discourse-update-notice-modal .update-notice-buttons button {
  flex: 1;
  max-width: 150px;
  padding: var(--size-2-2) var(--size-2-4);
  border-radius: var(--radius-m);
  cursor: pointer;
  font-weight: var(--font-weight-medium);
  font-size: var(--font-ui-medium);
  transition: all 0.2s ease;
  min-height: 36px;
  border: 1px solid var(--background-modifier-border);
  background-color: var(--background-secondary);
  color: var(--text-normal);
}

.discourse-update-notice-modal .update-notice-buttons button:hover {
  background-color: var(--background-modifier-hover);
}

.discourse-update-notice-modal .update-notice-buttons button.mod-cta {
  background-color: var(--interactive-accent);
  color: var(--text-on-accent);
  border-color: var(--interactive-accent);
}

.discourse-update-notice-modal .update-notice-buttons button.mod-cta:hover {
  background-color: var(--interactive-accent-hover);
  border-color: var(--interactive-accent-hover);
}
