:root {
  --bg-color: #fff;
  --text-color: #333;
  --border-color: #ddd;
  --mac-title-bg: #f5f5f5;
  --input-bg: #fff;
  --input-border: #ddd;
  --input-focus: #0d6efd;
  --button-bg: #2767cf;
  --button-text: #fff;
  --cancel-bg: #67696B;
  --cancel-border: #67696B;
  --mac-close-btn: #ff5f57;
  --win-title-bg: #F9F1EF;
  --win-button-bar-bg: #F0F0F0;
  --win-button-bar-border: #E0E0E0;
  --win-button-bg: #fdfdfd;
  --win-button-hover-border: #3C96DB;
  --win-button-hover-bg: #E0EEF9;
  --win-close-hover: #e81123;
  --mac-close-x: rgba(0, 0, 0, 0.5);
  --win-border: rgba(0, 0, 0, 0.1);
  --win-text: #000;
  --select-item-hover: rgba(13, 110, 253, 0.1);
  --select-item-shadow: rgba(0, 0, 0, 0.02);
  --select-item-shadow-dark: rgba(0, 0, 0, 0.1);
  --select-description: rgba(0, 0, 0, 0.6);
  --highlight-color: #ec3535;
  --wait-btn-hover: #ec3535;
  --scrollbar-thumb: rgba(0, 0, 0, 0.3);
  --input-box-shadow: rgba(13, 110, 253, 0.25)
}

:root[data-theme="dark"] {
  --bg-color: #282727;
  --text-color: #e0e0e0;
  --border-color: #404040;
  --mac-title-bg: #404143;
  --input-bg: #2d2d2d;
  --input-border: #404040;
  --win-title-bg: #17040B;
  --win-button-bar-bg: #1C1C1C;
  --win-button-bar-border: #1C1C1C;
  --win-button-bg: #353B3A;
  --win-button-hover-bg: #495150;
  --win-text: #fdfdfd;
  --content-bg: #36383A;
  --win-content-bg: #191919;
  --scrollbar-thumb: rgba(255, 255, 255, 0.3);
  --select-item-hover: rgba(13, 110, 253, 0.2);
  --select-description: rgba(255, 255, 255, 0.6);
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-color);
  color: var(--text-color);
  user-select: none;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 自定义滚动条样式 */
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  transition: background-color 0.3s;
  border-radius: 6px;
}

/* 悬浮时显示滚动条 */
*:hover::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  transition: background-color 0.3s;
}

/* 标题栏样式 */
.title-bar {
  background: var(--mac-title-bg);
  padding: 2px 12px;
  -webkit-app-region: drag;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  height: 20px;
}

.title-text {
  font-size: 12px;
  font-weight: normal;
}

.title-left {
  flex: 1;
  display: flex;
  align-items: center;
}

.logo {
  width: 20px;
  height: 20px;
  margin-right: 6px;
}

.platform-darwin .title-left {
  display: flex;
  align-items: center;
  justify-content: center
}

/* macOS 样式 */
.platform-darwin .title-bar {
  border-bottom: 1px solid var(--border-color);
}

.platform-darwin .close-btn {
  position: absolute;
  left: 8px;
  top: 7px;
  background-color: var(--mac-close-btn);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  opacity: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-app-region: no-drag;
}

.platform-darwin .close-btn::before,
.platform-darwin .close-btn::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 1px;
  background-color: var(--mac-close-x);
  transform-origin: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.platform-darwin .close-btn::before {
  transform: rotate(45deg);
}

.platform-darwin .close-btn::after {
  transform: rotate(-45deg);
}

.platform-darwin .close-btn:hover {
  background-color: var(--mac-close-btn);
}

.platform-darwin .close-btn:hover::before,
.platform-darwin .close-btn:hover::after {
  opacity: 1;
}

/* Windows 样式 */
.platform-win32 .title-bar {
  padding: 4px 0 4px 12px;
  background: var(--win-title-bg);
}

.platform-win32 .close-btn {
  -webkit-app-region: no-drag;
  width: 35px;
  height: 27px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  position: relative;
  opacity: 1;
  background: transparent;
}

.platform-win32 .close-btn::before,
.platform-win32 .close-btn::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 1px;
  background-color: var(--win-text);
}

.platform-win32 .close-btn::before {
  transform: rotate(45deg);
}

.platform-win32 .close-btn::after {
  transform: rotate(-45deg);
}

.platform-win32 .close-btn:hover {
  background-color: var(--win-close-hover);
}

.platform-win32 .close-btn:hover::before,
.platform-win32 .close-btn:hover::after {
  background-color: #fff;
}

/* 按钮栏样式 */
.platform-win32 .button-bar {
  padding: 6px 16px;
  background: var(--win-button-bar-bg);
  border-top: 1px solid var(--win-button-bar-border);
  height: 24px;
}

.container {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.content-wrapper {
  padding: 16px 16px 0 16px;
  min-height: 60px;
  max-height: 449px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
}

.platform-win32 .content-wrapper,
.dialog-buttons .content-wrapper {
  padding-bottom: 16px;
}

.content-wrapper {
  background: var(--content-bg);
}

.platform-win32 .content-wrapper {
  background: var(--win-content-bg);
}

/* 选择列表对话框的内容区域padding和高度 */
.dialog-select .content-wrapper {
  padding: 16px 8px;
  max-height: 600px;
}

#content {
  line-height: 1.4;
  font-size: 13px;
  user-select: text;
}

.button-bar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px;
  background: var(--content-bg);
  flex-shrink: 0;
}

button {
  padding: 4px 12px;
  border-radius: 4px;
  border: 1px solid var(--button-bg);
  background: var(--button-bg);
  color: var(--button-text);
  cursor: pointer;
  font-size: 13px;
  min-width: 70px;
  transition: all 0.2s ease;
}

button:hover {
  filter: brightness(1.2);
}

.platform-win32 #ok-btn,
.platform-win32 #cancel-btn {
  background: var(--win-button-bg);
  color: var(--win-text);
  border: 1px solid var(--win-border);
  padding: 2px 12px;
  height: 24px;
  border-radius: 2px;
  box-shadow: none;
}

.platform-win32 #ok-btn:hover,
.platform-win32 #cancel-btn:hover {
  border: 1px solid var(--win-button-hover-border);
  background-color: var(--win-button-hover-bg);
}

#ok-btn,
#cancel-btn {
  padding: 0 12px;
  height: 20px;
  width: 78px;
}

#cancel-btn {
  background: var(--cancel-bg);
  border: 1px solid var(--cancel-border);
}

#input-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-group label {
  display: block;
  padding: 0 0 4px 2px;
  color: var(--text-color);
  font-size: 13px;
}

.input-group input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--input-border);
  border-radius: 4px;
  font-size: 13px;
  box-sizing: border-box;
  background: var(--input-bg);
  color: var(--text-color);
}

.input-group input:focus {
  border-color: var(--input-focus);
  outline: none;
  box-shadow: 0 0 0 2px var(--input-box-shadow);
}

/* 文本区域样式 */
textarea {
  width: 100%;
  height: 400px;
  padding: 6px 8px;
  border: 1px solid var(--input-border);
  border-radius: 4px;
  font-size: 13px;
  resize: none;
  box-sizing: border-box;
  background: var(--input-bg);
  color: var(--text-color);
}

textarea:focus {
  border-color: var(--input-focus);
  outline: none;
  box-shadow: 0 0 0 2px var(--input-box-shadow);
}

/* 按钮组样式 */
#button-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 4px;
}

#button-container button {
  width: 100%;
  text-align: center;
  padding: 6px 12px;
}

/* 根据对话框类型显示/隐藏取消按钮 */
.dialog-message #cancel-btn {
  display: none;
}

.dialog-buttons .button-bar {
  display: none;
}

/* 隐藏所有对话框内容 */
#input,
#confirm,
#buttons,
#textarea,
#select {
  display: none;
}

/* 选择列表样式 */
.select-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 505px;
  overflow-y: auto;
}

.filter-input {
  padding: 0 2px 8px 2px;
}

.filter-input input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--input-border);
  border-radius: 4px;
  font-size: 13px;
  box-sizing: border-box;
  background: var(--input-bg);
  color: var(--text-color);
}

.filter-input input:focus {
  border-color: var(--input-focus);
  outline: none;
  box-shadow: 0 0 0 2px var(--input-box-shadow);
}

.select-list-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 360px;
  overflow-y: auto;
}

.select-item {
  display: flex;
  align-items: center;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  position: relative;
  transform: translateY(0) scale(1);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

.select-item.selected {
  background-color: var(--select-item-hover);
  position: relative;
  transform: translateY(-1px) scale(0.995);
  will-change: transform;
}

.select-item-icon {
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
  padding-right: 8px;
}

.select-item.selected .select-item-icon {
  transform: scale(1.05);
  filter: brightness(1.05);
}

/* 添加选择时的轻微阴影效果 */
.select-item.selected,
.select-list:not(.keyboard-nav) .select-item:hover {
  box-shadow: 0 1px 2px var(--select-item-shadow);
}

.select-item-icon {
  width: 34px;
  height: 34px;
  margin-right: 8px;
  border-radius: 4px;
  overflow: hidden;
}

.select-item-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.select-item-content {
  flex: 1;
  min-width: 0;
}

.select-item-title {
  font-size: 13px;
  line-height: 1.4;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.select-item-description {
  font-size: 12px;
  color: var(--select-description);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 搜索结果高亮样式 */
.highlight {
  color: var(--highlight-color);
}

/* 隐藏确定和取消按钮 */
.dialog-select .button-bar {
  display: none;
}

.dialog-wait-button .title-bar,
.dialog-wait-button .button-bar {
  display: none;
}

.dialog-wait-button .content-wrapper {
  padding: 0;
}

/* 按钮容器和按钮样式 */
#wait-button {
  display: none;
  position: absolute;
  inset: 0;
}

.wait-button-group {
  display: flex;
  height: 100%;
  border: none;
  background: none;
}

#wait-btn,
#wait-cancel-btn {
  height: 100%;
  border-radius: 0;
  cursor: pointer;
  color: white;
}

#wait-btn:hover,
#wait-cancel-btn:hover {
  filter: brightness(1.1);
}

#wait-btn {
  width: 100%;
  background: var(--button-bg);
  font-size: 14px;
  white-space: nowrap;
}

#wait-cancel-btn {
  width: 25px;
  min-width: 25px;
  font-size: 18px;
  padding: 0;
}

#wait-cancel-btn:hover {
  background-color: var(--wait-btn-hover);
}

/* 进度条对话框样式 */
.dialog-process .title-bar,
.dialog-process .button-bar {
  display: none;
}

.dialog-process .content-wrapper {
  padding: 0;
  background: var(--button-bg);
  color: white;
  min-height: auto;
  height: auto;
  overflow: visible;
}

#process {
  display: none;
  padding: 8px 12px;
  position: relative;
  -webkit-app-region: drag;
}

.process-text {
  font-size: 13px;
  margin-bottom: 8px;
  white-space: pre-wrap;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
  width: calc(100% - 15px);
  box-sizing: border-box;
  max-height: 250px;
  -webkit-app-region: no-drag;
}

.process-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.process-bar-inner {
  width: 0;
  height: 100%;
  background: white;
  border-radius: 2px;
  transition: width 0.3s ease;
}

@keyframes loading-bar-animation {
  0% {
    left: -80px;
  }

  100% {
    left: calc(100% + 80px);
  }
}

.process-bar-loading {
  position: absolute;
  width: 80px;
  height: 100%;
  background: white;
  border-radius: 2px;
  animation: loading-bar-animation 3s infinite linear;
}

/* 进度条按钮容器 */
.process-buttons {
  position: absolute;
  right: 8px;
  top: 6px;
  display: flex;
  gap: 8px;
  -webkit-app-region: no-drag;
  z-index: 1;
}

/* 进度条关闭按钮 */
.process-close-btn {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.process-close-btn:hover {
  opacity: 1;
}

.process-close-btn::before,
.process-close-btn::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 1px;
  background-color: white;
  transform-origin: center;
}

.process-close-btn::before {
  transform: rotate(45deg);
}

.process-close-btn::after {
  transform: rotate(-45deg);
}

/* 进度条暂停按钮 */
.process-pause-btn {
  width: 16px;
  height: 16px;
  display: none;
  /* 默认隐藏 */
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
  position: relative;
}

.process-pause-btn:hover {
  opacity: 1;
}

/* 暂停状态（显示两条竖线） */
.process-pause-btn::before,
.process-pause-btn::after {
  content: "";
  position: absolute;
  width: 2px;
  height: 10px;
  background-color: white;
  transition: all 0.2s ease;
}

.process-pause-btn::before {
  transform: translateX(-3px);
}

.process-pause-btn::after {
  transform: translateX(3px);
}

/* 播放状态（显示三角形） */
.process-pause-btn.paused::before {
  width: 0;
  height: 0;
  background: none;
  border-style: solid;
  border-width: 6px 0 6px 10px;
  border-color: transparent transparent transparent white;
  transform: translateX(1px);
}

.process-pause-btn.paused::after {
  display: none;
}

/* 显示暂停按钮 */
.show-pause .process-pause-btn {
  display: flex;
}
