/* ===================== 基础遮罩与容器 ===================== */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 10000;
}
.modal.show {
  display: block;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.modal.show .modal-backdrop {
  opacity: 1;
}

.modal.modal-transparent .modal-backdrop {
  background: rgba(0, 0, 0, 0.05);
}

/* ===================== 对话框 ===================== */
.modal-dialog {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, 90vw);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  color: #333;
  border-radius: var(--search-input-border-radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.modal.show .modal-dialog {
  opacity: 1;
}

.modal.modal-transparent .modal-dialog {
  background: transparent;
  box-shadow: none;
}

.modal.modal-transparent .modal-dialog *:not(.modal-range-active) {
  opacity: 0;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #eee;
  height: 44px;
  cursor: move;
}
/* 标题 */
#modal-title {
  font-size: 22px;
  font-weight: bold;
}
/* ===================== 内容区域（Body） ===================== */
.modal-body {
  padding: 16px;
  flex: 1;
  overflow: auto;
}
/* ===================== 表单与控件 ===================== */
.modal-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.modal-form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.modal-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.modal-range {
  width: 50%;
  appearance: none;
  height: 6px;
  background: rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  outline: none;
  accent-color: #00d1ff;
  transition: background 0.2s ease;
}
.modal-range:focus {
  box-shadow: 0 0 0 2px rgba(99, 64, 64, 0.2);
}
.modal-range:hover {
  background: rgba(0, 0, 0, 0.18);
}
.modal-range::-webkit-slider-runnable-track {
  height: 6px;
  background: rgba(0, 0, 0, 0.12);
  border-radius: 8px;
}
.modal-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid rgba(0, 0, 0, 0.2);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  margin-top: -5px;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.modal-range::-webkit-slider-thumb:hover {
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
  border-color: rgba(0, 209, 255, 0.6);
}
.modal-range::-webkit-slider-thumb:active {
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
  border-color: rgba(0, 209, 255, 0.8);
}
.modal-range::-moz-range-track {
  height: 6px;
  background: rgba(0, 0, 0, 0.12);
  border-radius: 8px;
}
.modal-range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid rgba(0, 0, 0, 0.2);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.modal-range::-moz-range-thumb:hover {
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
  border-color: rgba(0, 209, 255, 0.6);
}
.modal-range::-moz-range-thumb:active {
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
  border-color: rgba(0, 209, 255, 0.8);
}
.modal-range:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.modal-color {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid #ddd;
  border-radius: var(--search-input-border-radius);
  appearance: none;
  overflow: hidden;
}
.modal-color::-webkit-color-swatch-wrapper {
  padding: 0;
}
.modal-color::-webkit-color-swatch {
  border: none;
  border-radius: var(--search-input-border-radius);
}
.modal-color::-moz-focus-inner {
  border: 0;
  padding: 0;
}
.modal-color::-moz-color-swatch {
  border: none;
  border-radius: var(--search-input-border-radius);
}
.modal-form-row label {
  font-size: 13px;
  color: #666;
}
.modal-input {
  width: 100%;
  box-sizing: border-box;
  display: block;
  border: 1px solid #ddd;
  border-radius: var(--search-input-border-radius);
  padding: 8px 10px;
  font-size: 14px;
  background: #fff;
}
.modal-inline > .modal-input {
  flex: 1 1 auto;
  min-width: 0;
}

/* 自定义下拉选择 */
.custom-select {
  width: 100%;
  position: relative;
}
.modal-inline > .custom-select {
  flex: 1 1 auto;
  min-width: 0;
}
.custom-select-display {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #ddd;
  border-radius: var(--search-input-border-radius);
  padding: 8px 10px;
  font-size: 14px;
  background: #fff;
  color: #333;
  cursor: pointer;
}
.custom-select-menu {
  position: fixed;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: var(--search-input-border-radius);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08);
  max-height: 240px;
  overflow: auto;
  z-index: 10010;
  display: none;
}
.custom-select-menu {
  scrollbar-width: thin;
  scrollbar-color: rgba(99, 99, 99, 0.5) transparent;
}
.custom-select-menu::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.custom-select-menu::-webkit-scrollbar-track {
  background: transparent;
}
.custom-select-menu::-webkit-scrollbar-thumb {
  background: rgba(99, 99, 99, 0.5);
  border-radius: 6px;
}
.custom-select-menu::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 99, 99, 0.7);
}
.custom-select.open .custom-select-menu {
  display: block;
}
.custom-select-option {
  padding: 8px 10px;
  cursor: pointer;
  font-size: 14px;
}
.custom-select-option:hover {
  background: #f2f2f2;
}
.modal-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(99, 64, 64, 0.2);
}
.modal-input:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(99, 64, 64, 0.2);
}
/* ===================== 底部按钮区域（Footer） ===================== */
.modal-footer {
  display: flex;
  justify-content: flex-end;
  background-color: rgba(218, 218, 218, 0.1);
  padding: 12px 16px;
  border-top: 1px solid #eee;
  gap: 8px;
}

/* ===================== 按钮基础样式（无悬停位移/点击缩放） ===================== */
#modal-ok-btn,
#modal-close-btn {
  border: 1px solid #c9c9c9cd;
  background: #f8f8f8;
  color: #333;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
}
#modal-close-btn:hover,
#modal-ok-btn:hover {
  background: #efefef;
}

#modal-close-btn:focus,
#modal-ok-btn:focus {
  box-shadow: 0 0 0 2px rgba(99, 64, 64, 0.2);
}

/* ===================== 标签页（Tabs） ===================== */
.modal-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.modal-tab {
  padding: 6px 10px;
  border-radius: 12px;
  background-color: rgb(255, 255, 255);
  color: #000000;
  cursor: pointer;
}
.modal-tab:hover {
  background-color: #f2f2f2;
}
.modal-tab.active {
  background-color: var(--blur-bg-color-hover);
}

.settings-pane {
  display: none;
}
.settings-pane.active {
  display: block;
}
/* ===================== 更多壁纸网格（Grid） ===================== */
.modal-wallpaper-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}
.modal-wallpaper-item {
  width: 100%;
  padding-top: 66%;
  position: relative;
  border-radius: 12px;
  overflow: hidden;
}
.modal-wallpaper-item img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
  transform: scale(1);
}
.modal-wallpaper-item img:hover {
  transition: transform 0.4s ease;
  transform: scale(1.3);
}
/* 右键菜单（更多壁纸） */
.modal-wallpaper-context-menu {
  position: fixed;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
  z-index: 10020;
  display: none;
  min-width: 120px;
}
.modal-wallpaper-context-menu.open {
  display: block;
}
.modal-wallpaper-context-menu-item {
  padding: 8px 12px;
  font-size: 14px;
  color: #333;
  cursor: pointer;
}
.modal-wallpaper-context-menu-item:hover {
  background: #f2f2f2;
}
.modal-wallpaper-context-menu-item.disabled {
  color: #aaa;
  cursor: not-allowed;
}

/* 删除模式下的选中效果（无位移/缩放） */
.modal-wallpaper-item.selected::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 3px solid #00d1ff;
  border-radius: 12px;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.25) inset;
  background: rgba(0, 0, 0, 0.25);
  pointer-events: none;
}
.modal-wallpaper-item.selected::before {
  content: "✔";
  position: absolute;
  right: 6px;
  top: 4px;
  font-size: 18px;
  color: #fff;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.6);
  background: rgba(0, 209, 255, 0.7);
  border-radius: 10px;
  padding: 2px 6px;
}
/* ===================== 设置分组卡片 ===================== */
.settings-section {
  margin-bottom: 12px;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid #ddd;
}
.settings-section-title {
  font-weight: bold;
  margin-bottom: 6px;
}
/* ===================== 右上工具栏 ===================== */
.modal-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 8px;
}
.modal-action-btn {
  border: 1px solid #c9c9c9cd;
  background: #f8f8f8;
  color: #333;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.modal-action-btn:hover {
  background: #efefef;
}
/* ===================== 危险操作按钮 ===================== */
.modal-danger-btn {
  border: 1px solid #c9c9c9cd;
  background: #e74c3c;
  color: #fff;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.modal-danger-btn:hover {
  background: #c0392b;
}
/* 确认按钮的危险态（用于确认清除） */
#modal-ok-btn.modal-danger-btn {
  background: #e74c3c;
  color: #fff;
  border-color: #c0392b;
}
#modal-ok-btn.modal-danger-btn:hover {
  background: #c0392b;
}
/* ===================== 滚动条样式 ===================== */
.modal-body {
  scrollbar-width: thin;
  scrollbar-color: rgba(99, 99, 99, 0.5) transparent;
}
.modal-body::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
.modal-body::-webkit-scrollbar-track {
  background: transparent;
}
.modal-body::-webkit-scrollbar-thumb {
  background: rgba(99, 99, 99, 0.5);
  border-radius: 8px;
}
.modal-body::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 99, 99, 0.7);
}
