/* Tailwind CSS 自定义样式 */
@layer utilities {
  .content-auto {
    content-visibility: auto;
  }
  .shadow-soft {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  }
  .transition-all-300 {
    transition: all 300ms ease-in-out;
  }
  .hover-scale {
    transition: transform 0.3s ease;
  }
  .hover-scale:hover {
    transform: scale(1.02);
  }
}

/* 自定义颜色变量 */
:root {
  --primary: #165DFF;
  --secondary: #36D399;
  --accent: #8B5CF6;
  --dark: #1E293B;
  --light: #F8FAFC;
}

/* 额外的自定义样式 */
body {
  font-family: 'Inter', system-ui, sans-serif;
  overflow-x: hidden;
}

/* 确保导航栏sticky定位正常工作 */
#navbar {
  position: sticky !important;
  top: 0 !important;
  z-index: 9999 !important;
}

/* 导航栏滚动效果 */
.navbar-scrolled {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

/* 导航链接样式 */
.nav-link {
  position: relative;
  padding-bottom: 0.5rem;
  transition: all 0.3s ease;
}

/* 用户头像样式 */
#user-avatar-initial {
  user-select: none;
  line-height: 1;
}

/* 导航链接下划线效果（默认隐藏） */
.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--primary);
  transition: width 0.3s ease;
}

/* 当前页面导航链接激活状态 */
.nav-link.active {
  color: var(--primary) !important;
  font-weight: 600;
}

.nav-link.active::after {
  width: 100%;
}

/* 移动端导航链接激活状态 */
#mobile-menu a.active {
  color: var(--primary) !important;
  font-weight: 600;
  background-color: rgba(22, 93, 255, 0.05);
  border-left: 3px solid var(--primary);
  padding-left: 0.75rem;
}

/* 移动端菜单简化样式 */
#mobile-menu {
  max-height: calc(100vh - 60px);
  overflow-y: auto;
}

#mobile-menu nav {
  min-height: auto;
}

#mobile-menu .text-sm {
  font-size: 0.875rem;
  line-height: 1.5;
}

#mobile-menu .text-xs {
  font-size: 0.75rem;
  line-height: 1.4;
}

/* 搜索框聚焦效果 */
.search-input:focus {
  outline: none;
  ring: 2px;
  ring-color: rgba(22, 93, 255, 0.5);
}

/* 卡片悬停效果 */
.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

/* 按钮样式 */
.btn-primary {
  background-color: var(--primary);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  transition: all 0.3s ease;
}

.btn-primary:hover {
  background-color: rgba(22, 93, 255, 0.9);
  transform: translateY(-1px);
}

/* 工具分类按钮选中状态 */
.tool-category-btn.active {
  background-color: var(--primary);
  color: white;
}

.tool-category-btn.active:hover {
  background-color: #0E4FDC;
  color: white !important;
}

/* 分页器样式 */
.pagination-btn {
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}

.pagination-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.pagination-btn:not(:disabled):active {
  transform: scale(0.95);
}

#pagination-container {
  animation: fadeInUp 0.4s ease-out;
}

/* 移动端菜单样式 */
#mobile-menu {
  overflow: hidden;
  transition: all 0.3s ease-out;
  display: none;
}

#mobile-menu:not(.hidden) {
  display: block !important;
  animation: slideDown 0.3s ease-out;
}

#mobile-menu a {
  position: relative;
  display: block;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
}

#mobile-menu a:hover {
  background-color: rgba(22, 93, 255, 0.05);
  padding-left: 1.5rem;
}

#mobile-menu a:active {
  transform: scale(0.98);
}

#mobile-menu button {
  margin-top: 0.5rem;
  text-align: left;
  transition: all 0.2s ease;
}

#mobile-menu button:hover {
  transform: translateX(4px);
}

/* 移动端菜单按钮 */
#mobile-menu-btn {
  position: relative;
  padding: 0.5rem;
  transition: all 0.2s ease;
}

#mobile-menu-btn:active {
  transform: scale(0.95);
}

#mobile-menu-btn i {
  transition: transform 0.3s ease;
}

#mobile-menu-btn:hover i {
  transform: rotate(90deg);
}

/* 表格样式 */
.table-row:hover {
  background-color: rgba(249, 250, 251, 1);
}

/* 分页样式 */
.pagination-btn {
  padding: 0.5rem 1rem;
  border: 1px solid #d1d5db;
  background-color: white;
  color: #6b7280;
  transition: all 0.2s ease;
}

.pagination-btn:hover {
  background-color: #f9fafb;
}

.pagination-btn.active {
  background-color: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .mobile-hidden {
    display: none;
  }
  
  .mobile-full {
    width: 100%;
  }
}

/* 加载动画 */
.loading {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* 淡入动画 */
.fade-in {
  animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 搜索下拉框样式 */
#search-dropdown {
  animation: slideDown 0.2s ease-out;
  border-top: none;
  margin-top: -1px;
}



@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes slideUp {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

/* 提示词库页面样式 */
.prompt-card {
  transition: all 0.3s ease;
  transform: translateY(0);
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
}

.prompt-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  border: 2px solid #3b82f6;
  background: linear-gradient(white, white) padding-box,
              linear-gradient(135deg, #3b82f6, #1d4ed8, #3b82f6) border-box;
}

.prompt-card:active {
  transform: translateY(-4px) scale(0.98);
}

.category-btn {
  transition: all 0.3s ease;
  transform: scale(1);
}

.category-btn:hover {
  transform: scale(1.05);
}

.category-btn.active {
  background-color: #3b82f6 !important;
  color: white !important;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.category-btn.active:hover {
  background-color: #2563eb !important;
  transform: scale(1.08);
}

/* 搜索框动画效果 */
#searchInput {
  transition: all 0.3s ease;
}

#searchInput:focus {
  transform: scale(1.02);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 分页按钮动画 */
.pagination-btn {
  transition: all 0.2s ease;
}

.pagination-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* 页脚样式优化 - 统一首页样式 */
footer {
  background-color: white !important;
  border-top: 1px solid #e5e7eb !important;
  padding: 2rem 0 !important;
  margin-top: 4rem !important;
  opacity: 1;
  transform: translateY(0);
  animation: fadeInUp 1.4s ease-out both;
}

footer .container {
  max-width: 1200px !important;
  margin: 0 auto !important;
  padding: 0 1rem !important;
  text-align: center !important;
}

footer p {
  margin: 0 !important;
  color: #6b7280 !important;
}

footer p:first-child {
  margin-bottom: 0.5rem !important;
  font-size: 0.875rem !important;
}

footer p:last-child {
  font-size: 0.875rem !important;
}

footer a {
  transition: color 0.3s ease !important;
  color: #6b7280 !important;
}

footer a:hover {
  color: #3b82f6 !important;
}

footer span {
  color: #6b7280 !important;
}

/* 文本截断样式 */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 模态框动画 */
#promptModal {
  transition: all 0.3s ease;
  opacity: 0;
  transform: scale(0.95);
}

#promptModal.hidden {
  opacity: 0;
  visibility: hidden;
  transform: scale(0.95);
}

#promptModal:not(.hidden) {
  opacity: 1;
  transform: scale(1);
}

/* 搜索结果项悬停效果 */
.search-result-item {
  transition: all 0.2s ease;
}

.search-result-item:hover {
  background-color: rgba(249, 250, 251, 1);
  transform: translateX(2px);
}

.search-result-item.selected {
  background-color: rgba(22, 93, 255, 0.1);
  border-left: 3px solid var(--primary);
}

/* 高亮搜索关键词 */
mark {
  background-color: rgba(255, 235, 59, 0.3);
  padding: 1px 2px;
  border-radius: 2px;
  font-weight: 500;
}

/* 搜索框容器样式 */
.search-container {
  position: relative;
  z-index: 40;
}

.search-container:focus-within #search-dropdown {
  border-color: rgba(22, 93, 255, 0.3);
}

/* 搜索下拉框样式 */
#search-dropdown {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  z-index: 40;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.15), 0 10px 20px -5px rgba(0, 0, 0, 0.1);
  max-height: 400px;
  overflow-y: auto;
  width: 100%;
  transform: translateZ(0);
  margin-top: 4px;
  /* 隐藏滚动条 */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

#search-dropdown.hidden {
  display: none !important;
}

#search-dropdown:not(.hidden) {
  display: block !important;
  animation: slideDown 0.3s ease-out;
  opacity: 1;
  transform: translateY(0) translateZ(0);
}

#search-dropdown::-webkit-scrollbar {
  display: none; /* Chrome, Safari and Opera */
}

/* 热搜区域样式 */
.grid {
  position: relative;
  z-index: 1;
}

/* 确保热搜卡片在搜索下拉框下方 */
.bg-white.rounded-xl.shadow-soft {
  position: relative;
  z-index: 1;
}

/* 公告通知组件滚动样式 */
.marquee-container {
  overflow: hidden;
}

.marquee-content {
  display: inline-block;
  animation: marquee 30s linear infinite;
}

.marquee-content:hover {
  animation-play-state: paused;
}

@keyframes marquee {
  0% {
    transform: translateX(100%);
  }
  100% {
    transform: translateX(-100%);
  }
}

/* 公告关闭按钮样式 */
#close-announcement {
  cursor: pointer;
  font-size: 16px;
  padding: 2px;
}

#close-announcement:hover {
  transform: scale(1.1);
}

/* 分类导航样式 */
.category-card {
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.category-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.15);
  border-color: rgba(22, 93, 255, 0.2);
}

.category-card:hover .category-arrow {
  transform: translateX(4px);
  color: #165DFF;
}

.category-arrow {
  transition: all 0.3s ease;
}

.category-tag {
  transition: all 0.2s ease;
}

.category-tag:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 淡入上升动画 */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 下滑展开动画 */
@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    max-height: 500px;
    transform: translateY(0);
  }
}

/* 渐变文字效果 */
.gradient-text {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* 增强卡片阴影效果 */
.shadow-soft {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

.shadow-hover {
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* 模态框动画 */
@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.animate-modal-in {
  animation: modalIn 0.3s ease-out;
}

/* 模态框背景样式 */
#category-modal {
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
}

/* 确保模态框在移动设备上也有合适的间距 */
@media (max-width: 640px) {
  #category-modal {
    padding: 1rem !important;
  }
  
  #category-modal > div {
    max-height: calc(100vh - 2rem) !important;
  }
}

/* 模态框背景模糊效果 */
.backdrop-blur-sm {
  backdrop-filter: blur(4px);
}

/* 模态框内容区域自定义滚动条 */
#modal-content::-webkit-scrollbar {
  width: 8px;
}

#modal-content::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

#modal-content::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 10px;
}

#modal-content::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* 资源卡片悬停效果 */
.resource-card-hover {
  transition: all 0.3s ease;
}

.resource-card-hover:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.15);
}