/* ========================================
   UI 组件样式
   ======================================== */

/* Button styles */
button,
.btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  padding: 9px 10px;
  border-radius: 12px;
  font-size: 12.5px;
  cursor: pointer;
  transition: transform 0.04s ease, background 0.15s ease,
    border-color 0.15s ease;
  user-select: none;
}

button:hover,
.btn:hover {
  background: var(--panel2);
  border-color: rgba(255, 255, 255, 0.18);
}

[data-theme="light"] button:hover,
[data-theme="light"] .btn:hover {
  border-color: rgba(0, 0, 0, 0.16);
}

button:active {
  transform: translateY(1px);
}

button.primary {
  border-color: rgba(122, 162, 255, 0.4);
  background: rgba(122, 162, 255, 0.15);
}

button.primary:hover {
  background: rgba(122, 162, 255, 0.2);
}

button.danger {
  border-color: rgba(255, 107, 107, 0.42);
  background: rgba(255, 107, 107, 0.14);
}

button.danger:hover {
  background: rgba(255, 107, 107, 0.2);
}

/* Textarea */
textarea {
  width: 100%;
  height: 100%;
  border: 0;
  outline: none;
  resize: none;
  padding: 14px 14px 18px;
  background: transparent;
  color: var(--text);
  font-size: calc(var(--font-size) * 1.09375);
  line-height: 1.55;
  font-family: "Microsoft YaHei", "PingFang SC", var(--mono); 
  min-height: 220px;
}

/* Search input */
.search {
  width: 100%;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  outline: none;
  font-size: 12.5px;
}

[data-theme="light"] .search {
  background: rgba(0, 0, 0, 0.03);
}

/* Scrollbar styles */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--panel);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: var(--muted);
  border-radius: 10px;
  transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(65, 65, 65, 0.4);
}

/* Firefox scrollbar */
* {
  scrollbar-color: var(--muted) var(--panel);
  scrollbar-width: thin;
}

/* Pill badge */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
}

/* Keyboard shortcut indicator */
.kbd {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 2px 6px;
  border-radius: 8px;
  background: var(--panel);
}

/* List container */
.list {
  overflow: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Item card */
.item {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  padding: 10px 10px 9px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
}

.item:hover {
  background: rgba(255, 255, 255, 0.06);
}

[data-theme="light"] .item {
  background: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .item:hover {
  background: rgba(0, 0, 0, 0.05);
}

.item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.item-menu-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 8px;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
  transition: opacity 0.15s ease;
}

.item:hover .item-menu-btn {
  opacity: 1;
}

.item-menu-btn:hover {
  background: var(--panel2);
}

.item .meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}

.item .titleline {
  font-size: 12.8px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 620;
}

.item .preview {
  font-size: 12.3px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
  white-space: pre-wrap;
}

.item .row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* Tag */
.tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Context Menu */
.item-context-menu {
  position: fixed;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 4px;
  min-width: 120px;
  z-index: 1000;
  animation: menuFadeIn 0.12s ease;
}

@keyframes menuFadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.item-context-menu .menu-item {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease;
  user-select: none;
}

.item-context-menu .menu-item:hover {
  background: var(--panel2);
}

/* Toast notification */
.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 10px 12px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  font-size: 12.5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  max-width: min(720px, calc(100% - 30px));
  text-align: center;
  line-height: 1.35;
  z-index: 999;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
}

/* ========================================
   Modal 确认对话框样式
   ======================================== */

.modal-overlay-dialog {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1002;
  backdrop-filter: blur(4px);
}

.modal-dialog {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  max-width: 420px;
  width: 90%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: modalSlideIn 0.2s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-title {
  font-size: 16px;
  font-weight: 620;
  color: var(--text);
  letter-spacing: 0.3px;
}

.modal-message {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.5;
}

.modal-inputs {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-label {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 500;
}

.modal-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  font-family: var(--sans);
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.modal-input:focus {
  border-color: var(--accent);
  background: var(--panel2);
}

.modal-input::placeholder {
  color: var(--muted);
}

[data-theme="light"] .modal-input {
  background: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .modal-input:focus {
  background: rgba(0, 0, 0, 0.06);
}

.modal-buttons {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.modal-btn {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.04s ease, background 0.15s ease, border-color 0.15s ease;
  user-select: none;
}

.modal-btn:hover {
  background: var(--panel2);
  border-color: rgba(255, 255, 255, 0.25);
}

.modal-btn:active {
  transform: translateY(1px);
}

.modal-btn-ok {
  border-color: rgba(122, 162, 255, 0.4);
  background: rgba(122, 162, 255, 0.15);
}

.modal-btn-ok:hover {
  background: rgba(122, 162, 255, 0.2);
}

.modal-btn-cancel {
  border-color: rgba(255, 255, 255, 0.15);
}

[data-theme="light"] .modal-btn-cancel {
  border-color: rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .modal-btn-ok {
  border-color: rgba(47, 107, 255, 0.3);
  background: rgba(47, 107, 255, 0.12);
}

[data-theme="light"] .modal-btn-ok:hover {
  background: rgba(47, 107, 255, 0.18);
}

/* ========================================
   更多功能面板（仿ChatGPT设置面板）
   ======================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.more-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 800px;
  height: 80vh;
  max-height: 700px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* Header */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  gap: 12px;
}

.header-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.modal-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  border-radius: 10px;
  transition: background 0.15s ease;
  flex-shrink: 0;
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* Body: 两栏布局 */
.modal-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* 左侧导航栏 */
.modal-sidebar {
  width: 200px;
  border-right: 1px solid var(--line);
  background: var(--panel);
  flex-shrink: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
}

.sidebar-item:hover {
  background: rgba(122, 162, 255, 0.1);
}

.sidebar-item.active {
  background: rgba(122, 162, 255, 0.2);
  color: rgba(122, 162, 255, 1);
  border-left: 3px solid rgba(122, 162, 255, 1);
  padding-left: 11px;
}

[data-theme="light"] .sidebar-item.active {
  background: rgba(47, 107, 255, 0.15);
  color: rgba(47, 107, 255, 1);
  border-left-color: rgba(47, 107, 255, 1);
}

.sidebar-icon {
  font-size: 18px;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.sidebar-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 右侧内容区 */
.modal-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

.modal-panel {
  display: none;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.modal-panel.active {
  display: flex;
}

.panel-header {
  padding: 20px 28px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
}

.panel-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 28px;
}

/* ========================================
   回收站样式
   ======================================== */

.recycle-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.recycle-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: background 0.15s ease;
}

.recycle-item:hover {
  background: var(--panel2);
}

.recycle-item-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.recycle-item-title {
  font-weight: 500;
  font-size: 14px;
  color: var(--text);
}

.recycle-item-time {
  font-size: 12px;
  color: var(--muted);
}

.recycle-item-preview {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.5;
  max-height: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
}

.recycle-item-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.recycle-item-actions button {
  flex: 1;
  padding: 8px 12px;
  font-size: 12px;
}

.recycle-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.recycle-actions button {
  flex: 1;
  padding: 10px 16px;
}

/* ========================================
   导入/导出内容样式
   ======================================== */

.import-export-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.import-export-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px 16px;
  border-radius: 14px;
  background: var(--panel);
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid var(--line);
  color: var(--text);
  text-align: center;
}

.import-export-btn:hover {
  background: var(--panel2);
  transform: translateY(-2px);
}

.import-export-btn:active {
  transform: translateY(0);
}

.import-export-btn .btn-icon {
  font-size: 32px;
}

.import-export-btn .btn-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.import-export-btn .btn-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.btn-danger {
  padding: 10px 16px;
  border-radius: 12px;
  border-color: rgba(255, 107, 107, 0.42);
  background: rgba(255, 107, 107, 0.14);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease;
  border: 1px solid rgba(255, 107, 107, 0.42);
}

.btn-danger:hover {
  background: rgba(255, 107, 107, 0.2);
}

/* ========================================
   设置面板样式
   ======================================== */

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px;
  background: var(--panel);
  border-radius: 12px;
  border: 1px solid var(--line);
}

.settings-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.label-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.label-desc {
  font-size: 12px;
  color: var(--muted);
}

.font-size-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 200px;
}

.font-slider {
  flex: 1;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--panel2);
  border-radius: 5px;
  outline: none;
  cursor: pointer;
}

.font-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(122, 162, 255, 1);
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: background 0.15s ease;
}

.font-slider::-webkit-slider-thumb:hover {
  background: rgba(122, 162, 255, 1);
  box-shadow: 0 2px 8px rgba(122, 162, 255, 0.4);
}

.font-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(122, 162, 255, 1);
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: background 0.15s ease;
}

.font-slider::-moz-range-thumb:hover {
  background: rgba(122, 162, 255, 1);
  box-shadow: 0 2px 8px rgba(122, 162, 255, 0.4);
}

[data-theme="light"] .font-slider::-webkit-slider-thumb {
  background: rgba(47, 107, 255, 1);
}

[data-theme="light"] .font-slider::-webkit-slider-thumb:hover {
  box-shadow: 0 2px 8px rgba(47, 107, 255, 0.4);
}

[data-theme="light"] .font-slider::-moz-range-thumb {
  background: rgba(47, 107, 255, 1);
}

[data-theme="light"] .font-slider::-moz-range-thumb:hover {
  box-shadow: 0 2px 8px rgba(47, 107, 255, 0.4);
}

.font-size-value {
  font-size: 13px;
  color: var(--muted);
  min-width: 35px;
  text-align: right;
  font-family: var(--mono);
}

