This commit is contained in:
Zuoling Rong
2025-02-03 11:04:39 +08:00
parent 6273a6eb6b
commit 5acbb0d085
5 changed files with 717 additions and 161 deletions

575
style.css
View File

@@ -11,7 +11,7 @@ body {
background-color: #1a1b1e;
color: #e4e6eb;
min-height: 100vh;
overflow-x: hidden;
overflow: hidden; /* 防止body滚动 */
}
/* 布局 */
@@ -20,29 +20,58 @@ body {
min-height: 100vh;
opacity: 0;
animation: fadeIn 0.3s ease-out forwards;
overflow-x: hidden;
position: relative;
z-index: 1;
overflow: hidden; /* 防止layout滚动 */
}
/* 侧边栏样式 */
.sidebar {
width: 250px;
width: 240px;
background-color: #2d2e32;
padding: 2rem 1rem;
padding: 2rem 1.2rem;
display: flex;
flex-direction: column;
gap: 2rem;
position: fixed;
height: 100vh;
top: 0;
left: 0;
bottom: 0;
overflow-y: auto;
box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
z-index: 100;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
transform: translateZ(0);
height: 100vh; /* 确保高度固定 */
}
.sidebar::-webkit-scrollbar {
width: 6px;
}
.sidebar::-webkit-scrollbar-track {
background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
background-color: rgba(255, 255, 255, 0.1);
border-radius: 3px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
background-color: rgba(255, 255, 255, 0.2);
}
.logo h1 {
font-size: 1.5rem;
font-size: 1.4rem;
color: #fff;
margin-bottom: 2rem;
padding-left: 0.5rem;
letter-spacing: 0.5px;
}
/* 导航区域样式 */
.nav-section {
display: flex;
flex-direction: column;
@@ -50,21 +79,47 @@ body {
}
.section-title {
font-size: 0.9rem;
color: #8b8c8f;
font-size: 1rem;
color: #4a9eff;
padding: 0.5rem;
margin-bottom: 0.5rem;
display: flex;
align-items: center;
gap: 0.5rem;
}
.section-title i {
font-size: 1.2rem;
}
.nav-item {
display: flex;
align-items: center;
gap: 1rem;
padding: 0.8rem;
color: #a1a2a5;
text-decoration: none;
border-radius: 8px;
transition: all 0.3s ease;
position: relative;
}
.nav-item .icon-container {
width: 24px;
display: flex;
justify-content: center;
align-items: center;
margin-right: 1rem;
}
.nav-item .nav-text {
flex: 1;
}
.nav-item .external-icon {
font-size: 0.9rem;
opacity: 0.6;
margin-left: 0.5rem;
transition: all 0.3s ease;
}
.nav-item:hover {
@@ -72,6 +127,11 @@ body {
color: #fff;
}
.nav-item:hover .external-icon {
opacity: 1;
transform: translateX(2px);
}
.nav-item.active {
background-color: #3a3b3f;
color: #fff;
@@ -85,20 +145,39 @@ body {
/* 主内容区域 */
.content {
flex: 1;
margin-left: 250px;
margin-left: 240px;
padding: 2rem 0;
background-color: #1a1b1e;
position: relative;
min-height: 100vh;
height: 100vh; /* 固定高度 */
overflow-y: auto; /* 允许内容滚动 */
overflow-x: hidden;
max-width: calc(100vw - 250px);
max-width: calc(100vw - 240px);
display: flex;
flex-direction: column;
align-items: center;
}
/* 搜索框容器 - 固定在顶部 */
.search-container {
width: 100%;
display: flex;
justify-content: center;
padding: 0 2rem;
margin-bottom: 1rem;
position: sticky;
top: 0;
z-index: 10;
background-color: #1a1b1e;
padding-top: 2rem;
padding-bottom: 1rem;
}
/* 搜索框 */
.search-box {
position: relative;
width: 100%;
max-width: 600px;
margin: 0 2rem 3rem 2rem;
}
.search-box::after {
@@ -126,18 +205,20 @@ body {
.search-box input {
width: 100%;
padding: 1rem 4.5rem 1rem 1.5rem;
padding: 1rem 4rem 1rem 1.5rem;
border: none;
border-radius: 12px;
background-color: #2d2e32;
color: #fff;
font-size: 1rem;
transition: all 0.3s ease;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.search-box input:focus {
outline: none;
background-color: #3a3b3f;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.search-box input::placeholder {
@@ -161,69 +242,101 @@ body {
color: #f44336;
}
/* 页面容器 */
.page {
position: relative;
width: 100%;
display: none;
flex-direction: column;
align-items: center;
padding-top: 2rem;
}
.page.active {
display: flex;
animation: fadeIn 0.3s ease-out forwards;
}
/* 欢迎区域 */
.welcome-section {
margin: 0 2rem 3rem 2rem;
width: 100%;
max-width: 1200px;
margin: 0 auto 3.5rem auto;
padding: 0 6rem 0 8rem;
text-align: left;
position: relative;
z-index: 5;
}
.welcome-section h2 {
font-size: 2.5rem;
font-size: 2.4rem;
color: #fff;
margin-bottom: 0.5rem;
letter-spacing: 0.5px;
}
.welcome-section h3 {
font-size: 2rem;
color: #4a9eff;
margin-bottom: 1rem;
letter-spacing: 0.3px;
}
.welcome-section .subtitle {
color: #8b8c8f;
font-size: 1.1rem;
line-height: 1.5;
}
/* 分类样式 */
.category {
background-color: #2d2e32;
border-radius: 15px;
background: linear-gradient(145deg, #2f3035, #2b2c30);
border-radius: 16px;
padding: 2rem;
margin: 0 2rem 2rem 2rem;
transform: translateZ(0);
will-change: transform, opacity;
animation: none;
margin: 0 auto 2.5rem auto;
width: 100%;
max-width: 1100px;
position: relative;
z-index: 1;
opacity: 0;
transition: opacity 0.3s ease;
animation: fadeIn 0.5s ease-out forwards;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
border: 1px solid rgba(255, 255, 255, 0.03);
}
.category h2 {
color: #fff;
font-size: 1.2rem;
margin-bottom: 1.5rem;
color: #fff;
display: flex;
align-items: center;
gap: 0.8rem;
font-size: 1.2rem;
letter-spacing: 0.3px;
}
.category h2 i {
color: #4a9eff;
font-size: 1.3rem;
}
/* 网站卡片网格 */
.sites-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
gap: 1.2rem;
position: relative;
z-index: 1;
width: 100%;
}
/* 网站卡片样式 */
.site-card {
background-color: #3a3b3f;
background: linear-gradient(145deg, #363940, #31343a);
border-radius: 12px;
padding: 1.2rem;
text-decoration: none;
color: inherit;
transition: all 0.3s ease;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
display: flex;
flex-direction: column;
align-items: center;
@@ -233,27 +346,43 @@ body {
will-change: transform;
max-width: 100%;
position: relative;
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
border: 1px solid rgba(255, 255, 255, 0.05);
z-index: 2;
}
.site-card:hover {
transform: translateY(-5px);
background-color: #4a4b4f;
transform: translateY(-4px);
background: linear-gradient(145deg, #3e4249, #383b41);
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
border-color: rgba(255, 255, 255, 0.1);
}
.site-card i {
font-size: 2rem;
font-size: 1.8rem;
margin-bottom: 1rem;
color: #4a9eff;
transition: all 0.3s ease;
}
.site-card:hover i {
transform: scale(1.1);
color: #5ba9ff;
}
.site-card h3 {
font-size: 1rem;
margin-bottom: 0.5rem;
color: #fff;
font-weight: 500;
letter-spacing: 0.3px;
}
.site-card p {
font-size: 0.9rem;
color: #8b8c8f;
color: #a1a2a5;
margin: 0;
line-height: 1.4;
}
/* 添加编辑按钮 */
@@ -288,29 +417,37 @@ body {
/* 添加网站按钮 */
.add-site-btn {
background-color: #3a3b3f;
border: 2px dashed #4a4b4f;
border-radius: 12px;
padding: 1.2rem;
background: linear-gradient(145deg, #363940, #31343a);
border: 2px dashed rgba(255, 255, 255, 0.1);
border-radius: 14px;
padding: 1.5rem;
color: #8b8c8f;
cursor: pointer;
transition: all 0.3s ease;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 160px;
min-height: 180px;
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}
.add-site-btn:hover {
background-color: #4a4b4f;
border-color: #5a5b5f;
background: linear-gradient(145deg, #3e4249, #383b41);
border-color: #4a9eff;
color: #fff;
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}
.add-site-btn i {
font-size: 2rem;
margin-bottom: 0.5rem;
font-size: 2.2rem;
margin-bottom: 0.8rem;
transition: transform 0.3s ease;
}
.add-site-btn:hover i {
transform: scale(1.1);
}
/* 模态框样式 */
@@ -320,36 +457,44 @@ body {
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
background-color: rgba(0, 0, 0, 0.6);
display: none;
justify-content: center;
align-items: center;
z-index: 1000;
backdrop-filter: blur(4px);
}
.modal.active {
display: flex;
animation: modalFadeIn 0.3s ease-out forwards;
}
.modal-content {
background-color: #2d2e32;
border-radius: 15px;
padding: 2rem;
border-radius: 16px;
padding: 2.2rem;
width: 90%;
max-width: 500px;
max-width: 520px;
position: relative;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
transform: scale(0.95);
opacity: 0;
animation: modalContentShow 0.3s ease-out forwards;
}
.modal-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 1.5rem;
margin-bottom: 2rem;
}
.modal-header h3 {
color: #fff;
font-size: 1.2rem;
font-size: 1.3rem;
letter-spacing: 0.3px;
font-weight: 500;
}
.close-modal {
@@ -359,59 +504,73 @@ body {
cursor: pointer;
font-size: 1.5rem;
padding: 0.5rem;
transition: color 0.3s ease;
transition: all 0.3s ease;
border-radius: 8px;
}
.close-modal:hover {
color: #fff;
background-color: #3a3b3f;
}
/* 表单样式 */
.site-form {
display: flex;
flex-direction: column;
gap: 1rem;
gap: 1.2rem;
}
.form-group {
display: flex;
flex-direction: column;
gap: 0.5rem;
gap: 0.6rem;
}
.form-group label {
color: #8b8c8f;
font-size: 0.9rem;
font-size: 0.95rem;
letter-spacing: 0.2px;
}
.form-group input, .form-group select {
background-color: #3a3b3f;
border: none;
border-radius: 8px;
padding: 0.8rem 1rem;
border: 1px solid transparent;
border-radius: 10px;
padding: 0.9rem 1.2rem;
color: #fff;
font-size: 1rem;
transition: all 0.3s ease;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
.form-group input:focus, .form-group select:focus {
outline: none;
background-color: #4a4b4f;
background-color: #3a3b3f;
border-color: #4a9eff;
box-shadow: 0 2px 8px rgba(74, 158, 255, 0.15);
}
.form-group input::placeholder {
color: #8b8c8f;
}
.form-actions {
display: flex;
justify-content: flex-end;
gap: 1rem;
margin-top: 1.5rem;
margin-top: 2rem;
}
.btn {
padding: 0.8rem 1.5rem;
padding: 0.9rem 1.8rem;
border: none;
border-radius: 8px;
border-radius: 10px;
cursor: pointer;
font-size: 1rem;
transition: all 0.3s ease;
font-weight: 500;
letter-spacing: 0.3px;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
.btn-primary {
@@ -421,6 +580,8 @@ body {
.btn-primary:hover {
background-color: #3a8eef;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(74, 158, 255, 0.2);
}
.btn-secondary {
@@ -431,63 +592,144 @@ body {
.btn-secondary:hover {
background-color: #4a4b4f;
color: #fff;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
/* 响应式设计 */
@media (max-width: 1200px) {
.welcome-section {
padding: 0 4rem;
margin-bottom: 3rem;
}
.category {
max-width: 900px;
margin-bottom: 2rem;
}
}
@media (max-width: 768px) {
.menu-toggle {
display: block;
}
.content {
margin-left: 0;
max-width: 100vw;
padding-top: 4rem;
}
.sidebar {
width: 70px;
padding: 1rem 0.5rem;
width: 240px;
transform: translateX(-100%);
transition: transform 0.3s ease;
}
.sidebar.active {
transform: translateX(0);
}
.sidebar .logo h1,
.sidebar .section-title,
.sidebar .nav-item span {
display: none;
display: block;
}
.nav-item .nav-text,
.nav-item .external-icon {
display: inline;
}
.nav-item {
padding: 0.8rem;
justify-content: center;
justify-content: flex-start;
}
.nav-item i {
margin: 0;
font-size: 1.2rem;
.nav-item .icon-container {
margin-right: 1rem;
}
.content {
margin-left: 70px;
padding: 1rem 0;
}
.welcome-section h2 {
font-size: 2rem;
}
.welcome-section h3 {
font-size: 1.5rem;
}
.page {
transform: translateX(10px);
}
#search-results {
transform: translateY(10px);
}
.category {
margin: 0 1rem 2rem 1rem;
padding: 1.5rem;
.search-container {
padding: 0 1rem;
margin-bottom: 1rem;
}
.welcome-section {
margin: 0 1rem 2rem 1rem;
padding: 0 1.5rem;
margin-bottom: 2rem;
}
.search-box {
margin: 0 1rem 2rem 1rem;
.welcome-section h2 {
font-size: 1.8rem;
}
.welcome-section h3 {
font-size: 1.6rem;
}
.welcome-section .subtitle {
font-size: 1rem;
}
.category {
margin: 0 1rem 1.5rem 1rem;
padding: 1.5rem;
}
.sites-grid {
grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
gap: 1rem;
}
.site-card {
padding: 1rem;
}
.site-card .site-icon {
font-size: 1.8rem;
}
.site-card .site-name {
font-size: 0.9rem;
}
.site-card .site-desc {
font-size: 0.8rem;
}
}
@media (max-width: 480px) {
.welcome-section {
padding: 0 1rem;
margin-bottom: 1.5rem;
}
.welcome-section h2 {
font-size: 1.6rem;
}
.welcome-section h3 {
font-size: 1.4rem;
}
.category {
margin: 0 0.8rem 1rem 0.8rem;
padding: 1rem;
}
.sites-grid {
grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
gap: 0.8rem;
}
.site-card {
padding: 0.8rem;
}
.site-card .site-icon {
font-size: 1.6rem;
margin-bottom: 0.5rem;
}
}
@@ -495,7 +737,7 @@ body {
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(20px);
transform: translateY(10px);
}
to {
opacity: 1;
@@ -503,66 +745,125 @@ body {
}
}
.category {
animation: fadeIn 0.5s ease-out forwards;
}
/* 页面切换动画 */
.page {
position: absolute;
width: 100%;
opacity: 0;
visibility: hidden;
transform: translateX(20px);
transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s linear 0.3s;
will-change: opacity, transform;
}
.page.active {
opacity: 1;
visibility: visible;
transform: translateX(0);
transition-delay: 0s;
}
/* 搜索结果页面特殊处理 */
/* 搜索结果页面 */
#search-results {
transform: translateY(20px);
position: relative;
width: 100%;
display: none;
flex-direction: column;
align-items: center;
z-index: 15;
}
#search-results.active {
transform: translateY(0);
display: flex;
animation: fadeIn 0.3s ease-out forwards;
}
/* 搜索结果区域动画 */
/* 搜索结果区域 */
.search-section {
opacity: 0;
transform: translateY(10px);
transition: opacity 0.3s ease, transform 0.3s ease;
width: 100%;
max-width: 1100px;
margin: 0 auto;
position: relative;
z-index: 1;
}
.search-section[style*="display: block"] {
/* 清除之前可能导致问题的样式 */
.page {
transform: none;
visibility: visible;
transition: none;
}
#search-results {
transform: none;
}
.search-section {
transform: none;
opacity: 1;
transform: translateY(0);
}
/* 优化卡片动画 */
/* 优化布局结构 */
.layout {
position: relative;
z-index: 1;
}
.sidebar {
z-index: 100;
}
/* 确保内容不会重叠 */
.site-card {
backface-visibility: hidden;
transform: translateZ(0);
will-change: transform;
position: relative;
z-index: 2;
}
/* 优化动画性能 */
.category {
transform: translateZ(0);
will-change: transform, opacity;
animation: none;
.sites-grid {
position: relative;
z-index: 1;
width: 100%;
}
@keyframes modalFadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes modalContentShow {
from {
opacity: 0;
transform: scale(0.95);
}
to {
opacity: 1;
transform: scale(1);
}
}
/* 移动端菜单按钮 */
.menu-toggle {
display: none;
position: fixed;
top: 1rem;
left: 1rem;
z-index: 200;
background: none;
border: none;
color: #fff;
font-size: 1.5rem;
cursor: pointer;
padding: 0.5rem;
border-radius: 8px;
background-color: #2d2e32;
transition: all 0.3s ease;
}
.menu-toggle:hover {
background-color: #3a3b3f;
}
/* 遮罩层 */
.overlay {
display: none;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.5);
z-index: 99;
opacity: 0;
transition: opacity 0.3s ease;
}
.category[style*="display: block"],
.page.active .category {
.overlay.active {
display: block;
opacity: 1;
}