/* 现代响应式布局 - 完全分离侧边栏和主体内容 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
    background-color: #f8fafc;
    color: #334155;
    line-height: 1.5;
    min-height: 100vh;
}

/* 主布局容器 */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 - 完全独立 */
.sidebar {
    width: 240px;
    background: white;
    border-right: 1px solid #e2e8f0;
    padding: 24px 0;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 0 24px 20px 24px;
    border-bottom: 1px solid #f1f5f9;
    margin-bottom: 16px;
}

.sidebar-title {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.sidebar-subtitle {
    font-size: 13px;
    color: #64748b;
    margin-top: 4px;
}

.category-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 16px;
}

.category-item {
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    color: #475569;
    font-weight: 500;
    border: none;
    background: none;
    text-align: left;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.category-item:hover {
    background: #f8fafc;
    color: #334155;
}

.category-item.active {
    background: #3b82f6;
    color: white;
}

/* 矢量图标支持 */
.category-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* 字体图标样式 */
.icon-font {
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 图片图标样式 */
.icon-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.category-name {
    flex: 1;
}

/* 主内容区 - 完全独立 */
.main-content {
    flex: 1;
    margin-left: 240px;
    min-height: 100vh;
    padding: 24px;
    background: #f8fafc;
    transition: background 0.3s ease;
}

/* 搜索区域 */
.search-section {
    margin-bottom: 24px;
}

.search-box {
    position: relative;
    display: flex;
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    transition: all 0.15s ease;
    overflow: hidden;
    max-width: 500px;
}

.search-box:focus-within {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    border-color: #3b82f6;
}

.search-input {
    flex: 1;
    padding: 14px 16px;
    border: none;
    outline: none;
    font-size: 14px;
    background: transparent;
    color: #374151;
}

.search-input::placeholder {
    color: #9ca3af;
}

.search-btn {
    padding: 0 20px;
    background: #f8fafc;
    border: none;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    font-size: 14px;
    border-left: 1px solid #f1f5f9;
}

.search-btn:hover {
    background: #f1f5f9;
    color: #374151;
}

/* 内容头部 */
.content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.section-title {
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.results-count {
    font-size: 14px;
    color: #64748b;
}

/* 链接网格 */
.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.link-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid #f1f5f9;
    text-decoration: none;
    color: inherit;
    display: block;
    height: 72px;
}

.link-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.link-content {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 100%;
}

.link-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    flex-shrink: 0;
}

/* 链接图标的矢量图标支持 */
.link-icon .icon-font {
    font-size: 20px;
    color: #64748b;
}

.link-card:hover .link-icon .icon-font {
    color: #3b82f6;
}

.link-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.link-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}

.link-name {
    font-size: 15px;
    color: #1e293b;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.link-description {
    font-size: 13px;
    color: #64748b;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: #64748b;
    font-size: 14px;
    grid-column: 1 / -1;
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: #475569;
    font-weight: 600;
}

/* 移动端菜单按钮 */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1000;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }
    
    .main-content {
        margin-left: 220px;
    }
    
    .links-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: block;
    }
    
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: 60px 16px 16px 16px;
    }
    
    .links-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .link-card {
        height: 68px;
        padding: 14px;
    }
    
    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .section-title {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 100%;
    }
    
    .link-content {
        gap: 10px;
    }
    
    .link-card {
        height: 64px;
        padding: 12px;
    }
    
    .link-icon {
        width: 36px;
        height: 36px;
    }
    
    .link-name {
        font-size: 14px;
    }
    
    .link-description {
        font-size: 12px;
    }
}

/* 滚动条样式 */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}