/* ========== 主题变量 ========== */
:root {
  --theme-primary: #a855f7;
  --theme-primary-hover: #9333ea;
  --theme-accent: #ec4899;
  --theme-accent-hover: #db2777;
  --theme-light: #f3e8ff;
  --theme-light-hover: #e9d5ff;
  --theme-ring: rgba(168, 85, 247, 0.15);
}

/* ========== 滚动条 ========== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-thumb {
  background: #e9d5ff;
  border-radius: 3px;
}
.dark ::-webkit-scrollbar-thumb {
  background: #4b5563;
}

/* ========== 毛玻璃效果 ========== */
.glass {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
}
.dark .glass {
  background: rgba(24, 24, 27, 0.95);
}

/* ========== 渐变文字 ========== */
.gradient-text {
  background: linear-gradient(135deg, var(--theme-primary) 0%, var(--theme-accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ========== 弹窗 ========== */
.modal {
  display: none;
}
.modal.active {
  display: flex;
}

/* ========== 卡片悬浮 ========== */
.card-hover {
  transition: all 0.2s ease;
}
.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px -5px rgba(147, 51, 234, 0.15);
}
.dark .card-hover:hover {
  box-shadow: 0 8px 25px -5px rgba(0, 0, 0, 0.4);
}

/* ========== 字母图标 ========== */
.letter-icon {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--theme-primary);
}
.dark .letter-icon {
  color: #e5e7eb;
}

/* ========== 标签页按钮 ========== */
.tab-btn {
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  border-radius: 0.375rem;
  font-weight: 500;
  white-space: nowrap;
  color: #6b7280;
  transition: all 0.2s;
}
.tab-btn.active {
  background: white;
  color: #111827;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.dark .tab-btn {
  color: #9ca3af;
}
.dark .tab-btn.active {
  background: #27272a;
  color: #f4f4f5;
}

/* ========== 主按钮 ========== */
.btn-primary {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  background: linear-gradient(to right, var(--theme-primary), var(--theme-accent));
  color: white;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0.5rem;
  transition: all 0.2s;
}
.btn-primary:hover {
  background: linear-gradient(to right, var(--theme-primary-hover), var(--theme-accent-hover));
}

/* ========== 主题浅色按钮 ========== */
.theme-btn-light {
  padding: 0.5rem 1rem;
  background: var(--theme-light);
  color: var(--theme-primary);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0.5rem;
  transition: all 0.2s;
}
.theme-btn-light:hover {
  background: var(--theme-light-hover);
}
.dark .theme-btn-light {
  background: #3f3f46;
  color: #e4e4e7;
}
.dark .theme-btn-light:hover {
  background: #52525b;
}

/* ========== 设置卡片 ========== */
.settings-card {
  background: white;
  border-radius: 0.75rem;
  border: 1px solid var(--theme-light);
}
.dark .settings-card {
  background: #27272a;
  border-color: #3f3f46;
}

/* ========== 侧边栏按钮 ========== */
.sidebar-btn {
  display: block;
  width: 100%;
  padding: 0.625rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #4b5563;
  text-align: left;
  transition: all 0.2s;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-btn:hover {
  background: var(--theme-light);
  color: var(--theme-primary);
}
.dark .sidebar-btn {
  color: #d4d4d8;
}
.dark .sidebar-btn:hover {
  background: #3f3f46;
  color: #fafafa;
}

/* ========== 链接卡片 ========== */
.link-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem;
  background: white;
  border-radius: 0.75rem;
  border: 1px solid var(--theme-light);
  transition: all 0.2s;
}
.link-card:hover {
  border-color: var(--theme-primary);
}
.dark .link-card {
  background: #27272a;
  border-color: #3f3f46;
}
.dark .link-card:hover {
  border-color: #52525b;
}

/* ========== 输入框 ========== */
.input-field {
  width: 100%;
  padding: 0.625rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid var(--theme-light);
  background: white;
  font-size: 0.875rem;
  transition: all 0.2s;
}
.input-field:focus {
  outline: none;
  border-color: var(--theme-primary);
  box-shadow: 0 0 0 3px var(--theme-ring);
}
.dark .input-field {
  background: #18181b;
  border-color: #3f3f46;
  color: #fafafa;
}
.dark .input-field:focus {
  border-color: #71717a;
  box-shadow: 0 0 0 3px rgba(113, 113, 122, 0.2);
}
.dark .input-field::placeholder {
  color: #71717a;
}

/* ========== Toast ========== */
.toast-success {
  background: #dcfce7;
  color: #166534;
}
.toast-error {
  background: #fee2e2;
  color: #991b1b;
}
.toast-warning {
  background: #fef3c7;
  color: #92400e;
}
.toast-info {
  background: #dbeafe;
  color: #1e40af;
}
.dark .toast-success {
  background: #166534;
  color: #bbf7d0;
}
.dark .toast-error {
  background: #7f1d1d;
  color: #fecaca;
}
.dark .toast-warning {
  background: #78350f;
  color: #fde68a;
}
.dark .toast-info {
  background: #1e3a8a;
  color: #bfdbfe;
}

/* ========== 订阅状态 ========== */
.status-ok {
  background: #dcfce7;
  color: #166534;
}
.status-warning {
  background: #fef3c7;
  color: #92400e;
}
.status-expired {
  background: #fee2e2;
  color: #991b1b;
}
.dark .status-ok {
  background: #14532d;
  color: #86efac;
}
.dark .status-warning {
  background: #713f12;
  color: #fcd34d;
}
.dark .status-expired {
  background: #7f1d1d;
  color: #fca5a5;
}

/* ========== 暗色模式覆盖 ========== */
.dark .bg-white {
  background: #27272a !important;
}
.dark .dark\:bg-gray-800\/80 {
  background: #27272a !important;
}
.dark .dark\:bg-gray-800 {
  background: #18181b !important;
}
.dark .border-purple-100 {
  border-color: #3f3f46 !important;
}
.dark .dark\:border-purple-900\/50 {
  border-color: #3f3f46 !important;
}
.dark .dark\:border-purple-900 {
  border-color: #3f3f46 !important;
}
.dark .dark\:border-purple-800 {
  border-color: #3f3f46 !important;
}
.dark .bg-purple-50 {
  background: #3f3f46 !important;
}
.dark .dark\:bg-purple-900\/30 {
  background: #3f3f46 !important;
}
.dark .dark\:bg-purple-900\/50 {
  background: #3f3f46 !important;
}
.dark .dark\:bg-purple-900 {
  background: #3f3f46 !important;
}
.dark .dark\:bg-gray-700\/50 {
  background: #27272a !important;
}
.dark .dark\:text-purple-300 {
  color: #e4e4e7 !important;
}
.dark .dark\:text-purple-400 {
  color: #d4d4d8 !important;
}
.dark .dark\:hover\:bg-purple-800:hover {
  background: #52525b !important;
}
.dark .dark\:hover\:bg-purple-900\/50:hover {
  background: #52525b !important;
}

/* ========== 拖拽 ========== */
.draggable {
  cursor: grab;
}
.draggable:active {
  cursor: grabbing;
}
.dragging {
  opacity: 0.5;
  transform: scale(1.02);
}
.drag-over {
  border: 2px dashed #a855f7 !important;
  background: rgba(168, 85, 247, 0.1) !important;
}
.dark .drag-over {
  border-color: #71717a !important;
  background: rgba(113, 113, 122, 0.2) !important;
}

/* 分类拖拽 */
.cat-draggable {
  transition: all 0.2s;
}
.cat-draggable.dragging {
  opacity: 0.5;
}
.cat-draggable.cat-drag-over {
  background: rgba(168, 85, 247, 0.05);
  border-radius: 1rem;
  outline: 2px dashed #a855f7;
  outline-offset: 8px;
}
.dark .cat-draggable.cat-drag-over {
  background: rgba(113, 113, 122, 0.1);
  outline-color: #52525b;
}

/* ========== 点击次数 ========== */
.click-count {
  position: absolute;
  bottom: 4px;
  right: 4px;
  font-size: 10px;
  padding: 2px 6px;
  background: var(--theme-ring);
  color: var(--theme-primary);
  border-radius: 10px;
  opacity: 0;
  transition: opacity 0.2s;
}
.card-hover:hover .click-count {
  opacity: 1;
}
.dark .click-count {
  background: rgba(113, 113, 122, 0.3);
  color: #a1a1aa;
}

/* ========== 卡片选中状态（点击移动模式） ========== */
.card-selected {
  position: relative;
}
.card-selected .link-card {
  border: 2px solid var(--theme-primary) !important;
  background: rgba(168, 85, 247, 0.08) !important;
  box-shadow: 0 0 0 4px var(--theme-ring);
}
.card-selected::before {
  content: '已选中';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  padding: 2px 8px;
  background: var(--theme-primary);
  color: white;
  border-radius: 10px;
  z-index: 10;
  white-space: nowrap;
}
.dark .card-selected .link-card {
  border-color: #71717a !important;
  background: rgba(113, 113, 122, 0.2) !important;
  box-shadow: 0 0 0 4px rgba(113, 113, 122, 0.2);
}
.dark .card-selected::before {
  background: #52525b;
}

/* ========== 失效链接 ========== */
.link-dead {
  opacity: 0.6;
}
.link-dead .link-card {
  border-color: #fbbf24 !important;
}

/* ========== 笔记列表 ========== */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ========== 响应式 ========== */
@media (max-width: 640px) {
  .mobile-tabs {
    font-size: 12px;
  }
  .mobile-tabs button {
    padding: 6px 10px;
  }
}


/* ========== 搜索弹窗动画 ========== */
.search-modal-bg {
  opacity: 0;
  transition: opacity 0.2s ease;
}
.search-modal-bg.show {
  opacity: 1;
}
.search-modal-content {
  transform: translateY(-20px) scale(0.95);
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.search-modal-bg.show .search-modal-content {
  transform: translateY(0) scale(1);
  opacity: 1;
}
