/* Tavern Helper 样式 */

.tavern-helper {
  display: flex;
  flex-direction: column;
  height: 100%;
  background-color: var(--color-bg-primary);
  color: var(--color-text-primary);
}

/* 头部 */
.tavern-helper-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-md);
  border-bottom: 1px solid var(--color-border);
}

.tavern-helper-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.badge-new {
  background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
}

.version {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-left: auto;
}

.btn-extension-info {
  padding: var(--spacing-xs) var(--spacing-sm);
  background-color: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-extension-info:hover {
  background-color: var(--color-accent);
  color: white;
}

/* 标签页导航 */
.tavern-helper-tabs {
  display: flex;
  gap: var(--spacing-xs);
  padding: var(--spacing-sm) var(--spacing-md);
  background-color: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border);
}

.tab-button {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-sm) var(--spacing-md);
  background-color: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-button:hover {
  background-color: var(--color-bg-tertiary);
  color: var(--color-text-primary);
}

.tab-button.active {
  background-color: var(--color-accent);
  color: white;
  font-weight: 600;
}

.tab-icon {
  font-size: 1rem;
}

.tab-label {
  font-size: 0.9rem;
}

/* 内容区域 */
.tavern-helper-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--spacing-md);
}

.tab-content {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

/* 设置项通用样式 */
.setting-group {
  margin-bottom: var(--spacing-lg);
}

.setting-header {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  background-color: var(--color-bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  cursor: pointer;
  transition: all 0.15s ease;
}

.setting-header:hover {
  background-color: var(--color-bg-tertiary);
  border-color: var(--color-accent);
}

.setting-info {
  flex: 1;
}

.setting-info h4 {
  margin: 0 0 var(--spacing-xs) 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.setting-desc {
  margin: 0;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* 开关样式 */
.toggle-label {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.toggle-label input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: 24px;
  transition: all 0.2s ease;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 2px;
  background-color: var(--color-text-muted);
  border-radius: 50%;
  transition: all 0.2s ease;
}

.toggle-label input:checked + .toggle-slider {
  background-color: var(--color-accent);
  border-color: var(--color-accent);
}

.toggle-label input:checked + .toggle-slider:before {
  transform: translateX(20px);
  background-color: white;
}

/* 设置区块 */
.setting-section {
  margin-top: var(--spacing-lg);
}

.section-title {
  margin: 0 0 var(--spacing-md) 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.setting-section.experimental {
  opacity: 0.8;
}

.setting-section.experimental .section-title::before {
  content: "⚠️ ";
}

.setting-item {
  margin-bottom: var(--spacing-md);
  padding: var(--spacing-md);
  background-color: var(--color-bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.setting-item label {
  display: block;
  margin-bottom: var(--spacing-sm);
  font-size: 0.9rem;
  font-weight: 500;
}

.setting-control {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.setting-control input[type="number"] {
  width: 100px;
  padding: var(--spacing-xs) var(--spacing-sm);
  background-color: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
  font-size: 0.9rem;
}

.field-hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  line-height: 1.4;
}

/* 单选按钮组 */
.radio-group {
  display: flex;
  gap: var(--spacing-xs);
}

.radio-btn {
  padding: var(--spacing-xs) var(--spacing-md);
  background-color: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.radio-btn:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.radio-btn.active {
  background-color: var(--color-accent);
  border-color: var(--color-accent);
  color: white;
}

/* 脚本标签页 */
.scripts-toolbar {
  display: flex;
  gap: var(--spacing-xs);
  margin-bottom: var(--spacing-md);
}

.btn-tool {
  padding: var(--spacing-xs) var(--spacing-md);
  background-color: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-tool:hover {
  background-color: var(--color-accent);
  border-color: var(--color-accent);
  color: white;
}

/* 搜索框 */
.search-box {
  position: relative;
  margin-bottom: var(--spacing-lg);
}

.search-box input {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  padding-right: 40px;
  background-color: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  font-size: 0.9rem;
}

.search-box input:focus {
  outline: none;
  border-color: var(--color-accent);
}

.search-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-size: contain;
  opacity: 0.5;
}

/* 脚本区块 */
.script-section {
  margin-bottom: var(--spacing-lg);
  padding-bottom: var(--spacing-lg);
  border-bottom: 1px solid var(--color-border);
}

.script-section:last-child {
  border-bottom: none;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-xs);
}

.section-header h4 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.section-desc {
  margin: 0 0 var(--spacing-md) 0;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* 脚本列表 */
.script-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.script-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  background-color: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
}

.script-item:hover {
  background-color: var(--color-bg-tertiary);
  border-color: var(--color-accent);
}

.drag-handle {
  cursor: grab;
  opacity: 0.5;
  font-size: 0.9rem;
}

.drag-handle:hover {
  opacity: 1;
}

.script-name {
  flex: 1;
  font-size: 0.9rem;
  color: var(--color-text-primary);
}

.script-actions {
  display: flex;
  gap: var(--spacing-xs);
}

.btn-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

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

.btn-icon.danger:hover {
  background-color: rgba(255, 77, 77, 0.2);
  color: #ff4d4d;
}

/* 空状态 */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-xl);
  text-align: center;
  color: var(--color-text-muted);
}

.empty-state h3 {
  margin: 0 0 var(--spacing-sm) 0;
  font-size: 1.1rem;
  color: var(--color-text-secondary);
}

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

/* 滚动条美化 */
.tavern-helper-content::-webkit-scrollbar {
  width: 8px;
}

.tavern-helper-content::-webkit-scrollbar-track {
  background: transparent;
}

.tavern-helper-content::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

.tavern-helper-content::-webkit-scrollbar-thumb:hover {
  background-color: rgba(0, 0, 0, 0.3);
}
