/* 侧边栏图标字体 */
@font-face {
  font-family: 'sidebar-icons';
  src: url('data:font/woff2;charset=utf-8;base64,') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* 图标基础样式 */
.iconfont {
  font-family: 'sidebar-icons' !important;
  font-size: 16px;
  font-style: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 具体图标定义 */
.icon-folder::before { content: '\e8f4'; }
.icon-subfolder::before { content: '\e8f5'; }
.icon-article::before { content: '\e8f6'; }
.icon-comment::before { content: '\e8f7'; }
.icon-category::before { content: '\e8f8'; }
.icon-tag::before { content: '\e8f9'; }
.icon-time::before { content: '\e8fa'; }
.icon-eye::before { content: '\e8fb'; }
.icon-fire::before { content: '\e8fc'; }
.icon-search::before { content: '\e8fd'; }
.icon-calendar::before { content: '\e8fe'; }
.icon-sun::before { content: '\e8ff'; }
.icon-moon::before { content: '\e900'; }

/* 动画效果 */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.widget {
  animation: fadeInUp 0.6s ease-out;
}

/* 加载动画 */
.widget-loading {
  position: relative;
  overflow: hidden;
}

.widget-loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.4),
    transparent
  );
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* 响应式优化 */
@media (max-width: 768px) {
  .widget {
    margin-bottom: 15px;
  }
  
  .widget-content {
    padding: 15px;
  }
  
  .statistics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  
  .stat-item {
    padding: 10px;
    flex-direction: column;
    text-align: center;
  }
  
  .stat-icon {
    margin: 0 auto 8px;
    width: 36px;
    height: 36px;
  }
  
  .stat-icon i {
    font-size: 16px;
  }
  
  .stat-number {
    font-size: 16px;
  }
  
  .tag-cloud {
    gap: 6px;
  }
  
  .tag-link {
    padding: 4px 10px;
    font-size: 11px;
  }
  
  .recent-post-item,
  .hot-post-item {
    flex-direction: column;
    gap: 10px;
  }
  
  .recent-post-cover {
    width: 100%;
    height: 120px;
  }
  
  .hot-post-rank {
    align-self: flex-start;
    width: 20px;
    height: 20px;
    font-size: 11px;
  }
  
  .recent-comment-item {
    gap: 10px;
  }
  
  .recent-comment-avatar {
    width: 36px;
    height: 36px;
  }
  
  .category-link,
  .archive-link {
    padding: 6px 0;
    font-size: 14px;
  }
  
  .search-input {
    padding: 8px 36px 8px 14px;
    font-size: 13px;
  }
  
  .search-button {
    right: 6px;
    padding: 6px;
  }
  
  .search-button i {
    font-size: 14px;
  }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
  .widget {
    background-color: #2a2a2a;
    border-color: #404040;
  }
  
  .widget-title {
    background-color: #333;
    border-color: #404040;
  }
  
  .widget-title h3 {
    color: #e0e0e0;
  }
  
  .tag-link {
    background-color: #333;
    border-color: #404040;
    color: #b0b0b0;
  }
  
  .tag-link:hover {
    background-color: #ff6b81;
    color: white;
  }
  
  .category-link,
  .archive-link {
    color: #b0b0b0;
  }
  
  .category-link:hover,
  .archive-link:hover {
    color: #ff6b81;
  }
  
  .search-input {
    background-color: #333;
    border-color: #404040;
    color: #e0e0e0;
  }
  
  .search-input:focus {
    background-color: #2a2a2a;
    border-color: #ff6b81;
  }
  
  .stat-item {
    background-color: #333;
  }
  
  .stat-item:hover {
    background-color: rgba(255, 107, 129, 0.2);
  }
  
  .stat-number {
    color: #e0e0e0;
  }
  
  .stat-label {
    color: #b0b0b0;
  }
}

/* 可访问性优化 */
.widget:focus-within {
  outline: 2px solid var(--sr-primary-color);
  outline-offset: 2px;
}

.search-input:focus {
  outline: 2px solid var(--sr-primary-color);
  outline-offset: 2px;
}

/* 打印样式 */
@media print {
  .widget {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ddd;
  }
  
  .widget:hover {
    box-shadow: none;
  }
  
  .tag-link,
  .category-link,
  .archive-link {
    color: #333 !important;
    text-decoration: underline !important;
  }
}