/* Theme Switch */
  /* 夜间模式样式 */
body.dark-mode {
  background-color: #1a1a1a;
  color: #ffffff;
}
header.dark-mode {
  background-color: #2d2d2d;
  color: #ffffff;
}
footer.dark-mode {
  background-color: #2d2d2d;
  color: #ffffff;
}
.software-item.dark-mode {
  background-color: #2d2d2d;
  color: #ffffff;
}
button.dark-mode {
  background-color: #3d3d3d;
  color: #ffffff;
}
.advertisement-content.dark-mode {
  background-color: #2d2d2d;
  color: #ffffff;
}
/* 开关样式 */
.switch {
    margin:0 10px;
    font-size: 17px;
    position: relative;
    display: inline-block;
    width: 4em;
    height: 2.2em;
    border-radius: 30px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  }
  
  /* Hide default HTML checkbox */
  .switch input {
    opacity: 0;
    width: 0;
    height: 0;
  }
  
  /* The slider */
  .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #2a2a2a;
    transition: 0.4s;
    border-radius: 30px;
    overflow: hidden;
  }
  
  .slider:before {
    position: absolute;
    content: "";
    height: 1.2em;
    width: 1.2em;
    border-radius: 20px;
    left: 0.5em;
    bottom: 0.5em;
    transition: 0.4s;
    transition-timing-function: cubic-bezier(0.81, -0.04, 0.38, 1.5);
    box-shadow: inset 8px -4px 0px 0px #fff;
  }
  
  .switch input:checked + .slider {
    background-color: #00a6ff;
  }
  
  .switch input:checked + .slider:before {
    transform: translateX(1.8em);
    box-shadow: inset 15px -4px 0px 15px #ffcf48;
  }
  
  .star {
    background-color: #fff;
    border-radius: 50%;
    position: absolute;
    width: 5px;
    transition: all 0.4s;
    height: 5px;
  }
  
  .star_1 {
    left: 2.5em;
    top: 0.5em;
  }
  
  .star_2 {
    left: 2.2em;
    top: 1.2em;
  }
  
  .star_3 {
    left: 3em;
    top: 0.9em;
  }
  
  .switch input:checked ~ .slider .star {
    opacity: 0;
  }
  
  .cloud {
    width: 3.5em;
    position: absolute;
    bottom: -1.4em;
    left: -1.1em;
    opacity: 0;
    transition: all 0.4s;
  }
  
  .switch input:checked ~ .slider .cloud {
    opacity: 1;
  }
  
/*  通用样式  */
body {
  font-family: 'Roboto', sans-serif;
  margin: 0;
  padding: 0;
  background-color: #f8f9fa;
  color: #333;
  transition: background-color 0.3s ease, color 0.3s ease;
}

header {
    background-color: #ffffff;
    padding: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-around; /* 分类筛选居中，标题和搜索栏左右分散 */
    align-items: center;
}

.header-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

header h1 {
    margin: 0;
    font-size: 24px;
    color: #2196F3;
    text-align: left;
}

.category-filter {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 10px 20px;
    overflow-x: auto;
}

.category-filter button {
    padding: 8px 15px;
    border: none;
    border-radius: 20px;
    background-color: #e0e0e0;
    color: #555;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.category-filter button:hover,
.category-filter button.active {
    background-color: #2196F3;
    color: white;
}

.search-bar {
    display: flex;
    width: auto;
    max-width: none;
    margin-top: 0;
}

.search-bar input[type="text"] {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px 0 0 4px;
    outline: none;
    flex-grow: 1;
}

.search-bar button {
    padding: 10px 15px;
    border: none;
    background-color: #2196F3;
    color: white;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.search-bar button:hover {
    background-color: #1976D2;
}

main {
    padding: 20px;
    display: flex; /* 修改 main 为 Flexbox 布局，实现水平排列 */
    justify-content: space-between; /* 修改为 space-between，子元素之间均匀分布，首尾元素贴边 */
    align-items: flex-start; /* 子元素顶部对齐 */
}

#advertisement-area-left, /* 左侧广告位样式 */
#advertisement-area-right { /* 右侧广告位样式，与左侧广告位样式相同 */
    width: 10%; /* 修改后的广告位宽度：占据 main 容器的 10% */
    min-width: 100px; /* 可以根据需要调整最小宽度 */
    height: auto;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    background-color: #f0f0f0;
    text-align: center;
    /*  移除 margin: 0 10px;  实现广告位贴边效果 */
}

#software-list { /* 软件列表样式 */
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); /* 修改为自适应列数，每列最小 250px，最大 1fr */
    gap: 20px;
    max-width: 1200px; /*  可以保持原有的 max-width 限制，或者根据需要调整 */
    width: 60%; /* 软件列表宽度占据 main 容器的 60% (保持不变) */
}


.software-item {
    background-color: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease-out;
    cursor: pointer;
    perspective: 1000px;
    transform-style: preserve-3d;
    transform: perspective(1000px);
    will-change: transform;
}
.software-item:hover {
    transform: perspective(1000px) rotateX(var(--rotateX)) rotateY(var(--rotateY)) scale(1.02);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}

.software-icon {
    width: 100%;
    /* height: 150px;  移除固定的高度限制 */
    object-fit: cover;
    display: block;
}

.software-info {
    padding: 15px;
}

.software-name {
    font-size: 18px;
    margin-bottom: 10px;
    font-weight: bold;
}

.software-description {
    font-size: 14px;
    color: #666;
    line-height: 1.4;
}

.advertisement-content h3 {
    margin-top: 0;
    color: #555;
}

.advertisement-content p {
    color: #777;
    font-size: 14px;
    line-height: 1.5;
}


footer {
    text-align: center;
    padding: 20px;
    background-color: #ffffff;
    border-top: 1px solid #eee;
    color: #777;
}

/*  响应式设计，小屏幕下调整布局  */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .header-left {
        align-items: center;
    }

    header h1 {
        text-align: center;
    }

    .category-filter {
        justify-content: center;
        padding: 10px 20px;
    }

    .search-bar {
        width: 100%;
        max-width: none;
        margin-top: 10px;
        justify-content: center;
    }

    .search-bar input[type="text"], .search-bar button {
        border-radius: 4px;
    }

    .search-bar input[type="text"] {
        border-right: none;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
    }

    .search-bar button {
        border-left: none;
        border-top-left-radius: 0;
        border-top-right-radius: 0;
    }

    main { /* 小屏幕下 main 样式修改为垂直布局 */
        flex-direction: column;
        align-items: center;
    }

    #advertisement-area-left, /* 小屏幕下左右广告位样式 */
    #advertisement-area-right {
        width: 100%; /* 小屏幕下广告位宽度 100% */
        min-width: auto; /* 移除最小宽度限制 */
        margin: 20px 0; /*  为上下广告位添加上下外边距 */
    }


    #software-list { /* 小屏幕下软件列表宽度 100% */
        width: 100%;
        max-width: none;
    }
}

.header-left {
    display: flex;
    flex-direction: row; /*  确保 header-avatar 和 h1 水平排列 */
    align-items: center; /*  垂直居中对齐头像和标题 */
}

.header-avatar {
    width: 40px; /*  设置头像宽度 */
    height: 40px; /*  设置头像高度，宽度和高度相等时，配合 border-radius: 50% 可以得到圆形头像 */
    border-radius: 50%; /*  设置边框为圆形，使头像显示为圆形  */
    margin-right: 10px; /*  设置头像与标题文字之间的间距，可以根据需要调整  */
    vertical-align: middle; /*  将头像与标题文字垂直方向居中对齐 */
    object-fit: cover; /*  确保图片在容器内完整显示，并可能进行裁剪以适应容器 */
}



/* Theme Switch */
/* 开关样式 */
.switch {
    margin:0 10px;
    font-size: 17px;
    position: relative;
    display: inline-block;
    width: 4em;
    height: 2.2em;
    border-radius: 30px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  }
  
  /* Hide default HTML checkbox */
  .switch input {
    opacity: 0;
    width: 0;
    height: 0;
  }
  
  /* The slider */
  .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #2a2a2a;
    transition: 0.4s;
    border-radius: 30px;
    overflow: hidden;
  }
  
  .slider:before {
    position: absolute;
    content: "";
    height: 1.2em;
    width: 1.2em;
    border-radius: 20px;
    left: 0.5em;
    bottom: 0.5em;
    transition: 0.4s;
    transition-timing-function: cubic-bezier(0.81, -0.04, 0.38, 1.5);
    box-shadow: inset 8px -4px 0px 0px #fff;
  }
  
  .switch input:checked + .slider {
    background-color: #00a6ff;
  }
  
  .switch input:checked + .slider:before {
    transform: translateX(1.8em);
    box-shadow: inset 15px -4px 0px 15px #ffcf48;
  }
  
  .star {
    background-color: #fff;
    border-radius: 50%;
    position: absolute;
    width: 5px;
    transition: all 0.4s;
    height: 5px;
  }
  
  .star_1 {
    left: 2.5em;
    top: 0.5em;
  }
  
  .star_2 {
    left: 2.2em;
    top: 1.2em;
  }
  
  .star_3 {
    left: 3em;
    top: 0.9em;
  }
  
  .switch input:checked ~ .slider .star {
    opacity: 0;
  }
  
  .cloud {
    width: 3.5em;
    position: absolute;
    bottom: -1.4em;
    left: -1.1em;
    opacity: 0;
    transition: all 0.4s;
  }
  
  .switch input:checked ~ .slider .cloud {
    opacity: 1;
  }
  
