Files
mengya-nav/cf-nav-frontend/styles.css
2026-03-11 20:46:24 +08:00

931 lines
19 KiB
CSS
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
:root {
--primary-color: #4361ee;
--secondary-color: #3f37c9;
--success-color: #4cc9f0;
--dark-color: #1e293b;
--light-color: #f8fafc;
--gray-color: #64748b;
--border-radius: 10px;
--box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
--transition: all 0.25s ease;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #f5f7fa 0%, #e4edf5 100%);
color: var(--dark-color);
line-height: 1.5;
padding: 12px;
min-height: 100vh;
}
/* 全屏背景图层:仅当 config 中 SITE_BACKGROUND_IMAGES 非空时由 JS 插入,约 30% 高斯模糊 */
.site-bg {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: -1;
background-size: cover;
background-position: center;
background-repeat: no-repeat;
filter: blur(10px);
opacity: 0.85;
}
.container {
max-width: 1500px;
margin: 0 auto;
}
header {
text-align: center;
margin-bottom: 16px;
padding: 10px 0;
}
.main-header {
display: flex;
align-items: center;
justify-content: center;
padding: 10px 0;
margin-bottom: 16px;
}
.main-header h1 {
margin: 0;
flex: 1;
text-align: center;
}
/* 左上角固定「分类」按钮:不随页面滚动 */
.category-toggle-fixed {
position: fixed;
left: 16px;
top: 16px;
z-index: 998;
}
body.category-sidebar-open .category-toggle-fixed {
z-index: 997;
}
.category-toggle-btn {
padding: 8px 14px;
border-radius: 8px;
border: 1px solid rgba(67, 97, 238, 0.35);
background: white;
color: var(--primary-color);
font-size: 0.9rem;
font-weight: 600;
cursor: pointer;
transition: var(--transition);
box-shadow: 0 2px 8px rgba(67, 97, 238, 0.1);
}
.category-toggle-btn:hover {
background: var(--primary-color);
color: white;
border-color: var(--primary-color);
box-shadow: 0 4px 12px rgba(67, 97, 238, 0.25);
}
/* 分类侧边栏:固定不随页面滚动 */
.category-sidebar-backdrop {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.35);
z-index: 999;
opacity: 0;
visibility: hidden;
transition: opacity 0.25s ease, visibility 0.25s ease;
}
body.category-sidebar-open .category-sidebar-backdrop {
opacity: 1;
visibility: visible;
}
.category-sidebar {
position: fixed;
top: 0;
left: 0;
width: 280px;
max-width: 85vw;
height: 100vh;
background: white;
box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
z-index: 1000;
display: flex;
flex-direction: column;
transform: translateX(-100%);
transition: transform 0.3s ease;
overflow: hidden;
}
body.category-sidebar-open .category-sidebar {
transform: translateX(0);
}
body.category-sidebar-open {
overflow: hidden;
}
.category-sidebar-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 16px 18px;
border-bottom: 1px solid #f1f5f9;
flex-shrink: 0;
}
.category-sidebar-header h2 {
font-size: 1.15rem;
font-weight: 700;
color: var(--dark-color);
margin: 0;
}
.category-sidebar-close {
width: 36px;
height: 36px;
border: none;
background: #f1f5f9;
border-radius: 50%;
font-size: 1.5rem;
line-height: 1;
cursor: pointer;
color: var(--gray-color);
display: flex;
align-items: center;
justify-content: center;
transition: var(--transition);
}
.category-sidebar-close:hover {
background: #e2e8f0;
color: var(--dark-color);
}
.category-sidebar-list {
flex: 1;
overflow-y: auto;
padding: 12px 14px;
display: flex;
flex-direction: column;
gap: 6px;
}
.category-sidebar-list .category-filter {
display: block;
width: 100%;
padding: 12px 14px;
text-align: left;
border-radius: 10px;
font-size: 0.9rem;
}
.category-sidebar-list .category-filter:hover:not(.active) {
background: #f8fafc;
}
/* 隐藏整个页面的滚动条 */
html {
/* 隐藏IE/Edge滚动条 */
-ms-overflow-style: none;
/* 隐藏Firefox滚动条 */
scrollbar-width: none;
}
/* 隐藏Chrome/Safari/Opera滚动条 */
html::-webkit-scrollbar {
display: none;
}
/* 确保滚动功能正常 */
body {
/* 允许滚动 */
overflow-y: scroll;
/* 防止内容抖动,保持滚动条空间 */
overflow-x: hidden;
/* 兼容WebKit内核浏览器 */
-webkit-overflow-scrolling: touch;
}
h1 {
font-size: 2.1rem;
margin-bottom: 6px;
background: linear-gradient(45deg, var(--primary-color), var(--success-color));
-webkit-background-clip: text;
background-clip: text;
color: transparent;
font-weight: 800;
letter-spacing: -0.5px;
}
.subtitle {
display: none;
}
.web-search-box {
background: rgba(255, 255, 255, var(--site-glass-opacity, 0.78));
border-radius: 14px;
padding: 20px 22px;
margin-bottom: 20px;
box-shadow: 0 8px 32px rgba(67, 97, 238, 0.18), 0 4px 12px rgba(0, 0, 0, 0.06);
border: 2px solid rgba(67, 97, 238, 0.2);
}
#web-search-form {
width: 100%;
}
.search-wrapper {
display: flex;
align-items: center;
gap: 12px;
position: relative;
}
#web-search-input {
flex: 1;
min-width: 0;
padding: 16px 18px 16px 46px;
border: 2px solid rgba(67, 97, 238, 0.3);
border-radius: 50px;
font-size: 1.05rem;
transition: var(--transition);
background: linear-gradient(135deg, #f8faff 0%, #f0f4ff 100%);
box-shadow: 0 4px 12px rgba(67, 97, 238, 0.12), inset 0 1px 0 rgba(255,255,255,0.8);
}
#web-search-input::placeholder {
color: var(--gray-color);
}
#web-search-input:hover {
border-color: var(--primary-color);
background: #fff;
box-shadow: 0 4px 16px rgba(67, 97, 238, 0.15);
}
#web-search-input:focus {
outline: none;
border-color: var(--primary-color);
box-shadow: 0 0 0 5px rgba(67, 97, 238, 0.25);
background: #fff;
}
.search-wrapper .search-icon {
position: absolute;
left: 18px;
font-size: 1.35rem;
color: var(--primary-color);
opacity: 0.95;
}
.search-select {
padding: 8px 10px;
border: 1px solid #ddd;
border-radius: 8px;
background: white;
cursor: pointer;
font-size: 0.82rem;
transition: var(--transition);
font-weight: 500;
flex-shrink: 0;
max-width: 100px;
}
.search-select:hover {
border-color: var(--primary-color);
}
.search-select:focus {
outline: none;
border-color: var(--primary-color);
box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
}
@media (max-width: 768px) {
.web-search-box {
padding: 16px 14px;
margin-bottom: 16px;
}
/* 移动端:搜索框与搜索引擎下拉并排同一行(并排 = side-by-side */
.search-wrapper {
flex-direction: row;
align-items: center;
gap: 8px;
}
#web-search-input {
flex: 1;
min-width: 0;
width: auto;
padding: 14px 12px 14px 42px;
font-size: 1rem;
}
.search-wrapper .search-icon {
left: 14px;
font-size: 1.2rem;
}
.search-select {
width: auto;
min-width: 72px;
max-width: 36%;
padding: 8px 8px;
font-size: 0.78rem;
}
}
.add-site-btn {
background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
color: white;
border: none;
padding: 9px 18px;
font-size: 0.95rem;
border-radius: 50px;
cursor: pointer;
margin: 0;
display: inline-flex;
align-items: center;
justify-content: center;
box-shadow: 0 4px 12px rgba(67, 97, 238, 0.28);
transition: var(--transition);
font-weight: 600;
letter-spacing: 0.2px;
white-space: nowrap;
}
.add-site-btn:hover {
transform: translateY(-2px);
box-shadow: 0 6px 18px rgba(67, 97, 238, 0.4);
}
.add-site-btn:active {
transform: translateY(0);
}
.modal {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.6);
z-index: 1000;
justify-content: center;
align-items: center;
}
.modal-content {
background-color: white;
border-radius: var(--border-radius);
width: 92%;
max-width: 560px;
box-shadow: var(--box-shadow);
animation: modalOpen 0.35s ease-out;
overflow: hidden;
}
@keyframes modalOpen {
from { opacity: 0; transform: translateY(-16px); }
to { opacity: 1; transform: translateY(0); }
}
.modal-header {
padding: 16px 20px;
background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
color: white;
display: flex;
justify-content: space-between;
align-items: center;
}
.modal-header h2 {
font-size: 1.25rem;
font-weight: 600;
}
.close-modal {
background: none;
border: none;
color: white;
font-size: 1.6rem;
cursor: pointer;
width: 32px;
height: 32px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
transition: var(--transition);
}
.close-modal:hover {
background-color: rgba(255, 255, 255, 0.2);
}
.modal-body {
padding: 18px 20px 20px;
}
.form-group {
margin-bottom: 14px;
}
.form-group label {
display: block;
margin-bottom: 6px;
font-weight: 500;
color: var(--dark-color);
}
.form-group input,
.form-group textarea,
.form-group select {
width: 100%;
padding: 10px 12px;
border: 1px solid #ddd;
border-radius: 8px;
font-size: 0.95rem;
transition: var(--transition);
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
outline: none;
border-color: var(--primary-color);
box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.18);
}
.form-group textarea {
min-height: 70px;
resize: vertical;
}
.form-row {
display: flex;
gap: 12px;
}
.form-row .form-group {
flex: 1;
}
.submit-btn {
background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
color: white;
border: none;
padding: 11px 18px;
font-size: 0.98rem;
border-radius: 8px;
cursor: pointer;
width: 100%;
font-weight: 600;
letter-spacing: 0.3px;
transition: var(--transition);
margin-top: 6px;
}
.submit-btn:hover {
transform: translateY(-1px);
box-shadow: 0 4px 10px rgba(67, 97, 238, 0.25);
}
.categories-container {
display: grid;
gap: 16px;
}
.category-section {
background: rgba(255, 255, 255, var(--site-glass-opacity, 0.78));
border-radius: var(--border-radius);
box-shadow: var(--box-shadow);
padding: 16px;
transition: var(--transition);
}
.category-section:hover {
transform: translateY(-2px);
box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
}
.category-title {
font-size: 1.2rem;
margin-bottom: 12px;
padding-bottom: 8px;
border-bottom: 2px solid #f1f5f9;
display: flex;
align-items: center;
color: var(--dark-color);
font-weight: 700;
}
.category-title::before {
content: "";
display: inline-block;
width: 6px;
height: 18px;
background: var(--primary-color);
border-radius: 4px;
margin-right: 10px;
}
.sites-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
gap: 10px;
}
.site-card {
background: rgba(255, 255, 255, var(--site-glass-opacity, 0.78));
border-radius: 12px;
padding: 14px 10px;
text-align: center;
transition: var(--transition);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
border: 1px solid transparent;
cursor: pointer;
display: flex;
flex-direction: column;
align-items: center;
min-height: 140px;
text-decoration: none;
color: var(--dark-color);
position: relative;
}
/* 卡片右上角点击次数,可与内容重叠 */
.site-card-clicks {
position: absolute;
top: 2px;
right: 4px;
font-size: 9px;
line-height: 1;
color: #94a3b8;
z-index: 2;
pointer-events: none;
}
/* 图标固定在最上方 */
.site-icon {
width: 64px;
height: 64px;
border-radius: 12px;
background-color: #f1f5f9;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 8px;
overflow: hidden;
flex-shrink: 0;
}
.site-icon img {
width: 48px;
height: 48px;
object-fit: contain;
}
/* 中间区域:网站名称+描述,弹性占据剩余空间 */
.site-card-body {
flex: 1;
min-height: 0;
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
overflow: hidden;
}
.site-name {
font-weight: 600;
font-size: 0.9rem;
margin-bottom: 4px;
width: 100%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
line-height: 1.3;
flex-shrink: 0;
}
.site-description {
font-size: 0.75rem;
color: var(--gray-color);
width: 100%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
line-height: 1.3;
flex: 1;
min-height: 0;
}
/* 标签固定在最下方,不受名称和描述影响 */
.site-tags {
width: 100%;
margin-top: auto;
flex-shrink: 0;
display: flex;
flex-wrap: nowrap;
gap: 4px;
justify-content: center;
overflow: hidden;
}
.site-card:hover {
transform: translateY(-3px);
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
border-color: rgba(67, 97, 238, 0.2);
}
.tag {
background: #eef2ff;
color: var(--primary-color);
font-size: 0.65rem;
padding: 2px 6px;
border-radius: 10px;
font-weight: 500;
white-space: nowrap;
flex-shrink: 0;
}
.empty-state {
text-align: center;
padding: 30px 20px;
color: var(--gray-color);
}
.empty-state p {
margin-top: 8px;
font-size: 1rem;
}
.empty-state button {
margin-top: 12px;
}
.top-bar {
background: rgba(255, 255, 255, var(--site-glass-opacity, 0.78));
border-radius: var(--border-radius);
padding: 8px 14px;
margin-bottom: 12px;
display: flex;
align-items: center;
gap: 12px;
box-shadow: var(--box-shadow);
}
.stats-group {
display: flex;
align-items: center;
gap: 12px;
flex-shrink: 0;
}
.search-container {
max-width: 560px;
margin: 0 auto 16px;
position: relative;
}
.search-container.compact {
margin: 0;
max-width: 500px;
flex: 1;
}
.search-container input {
width: 100%;
padding: 9px 16px 9px 36px;
border-radius: 50px;
border: 1px solid #ddd;
font-size: 0.93rem;
box-shadow: var(--box-shadow);
transition: var(--transition);
}
.search-container input:focus {
border-color: var(--primary-color);
box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.18);
}
.search-icon {
position: absolute;
left: 14px;
top: 50%;
transform: translateY(-50%);
color: var(--gray-color);
font-size: 1.1rem;
}
.stats-item {
display: flex;
align-items: center;
gap: 4px;
font-size: 0.85rem;
font-weight: 500;
white-space: nowrap;
}
.stats-item span {
font-weight: 700;
color: var(--primary-color);
}
@media (max-width: 1024px) {
.sites-grid {
grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
}
}
@media (max-width: 768px) {
body {
padding: 10px;
}
h1 {
font-size: 1.85rem;
}
.sites-grid {
grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
}
.form-row {
flex-direction: column;
gap: 0;
}
.top-bar {
flex-direction: column;
gap: 10px;
}
.stats-group {
width: 100%;
justify-content: space-around;
flex-wrap: wrap;
gap: 8px;
}
.search-container.compact {
width: 100%;
max-width: none;
}
.add-site-btn {
width: 100%;
}
}
@media (max-width: 480px) {
.sites-grid {
grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
gap: 8px;
}
.site-card {
padding: 10px 6px;
min-height: 120px;
}
.site-icon {
width: 48px;
height: 48px;
}
.site-icon img {
width: 36px;
height: 36px;
}
.site-name {
font-size: 0.85rem;
}
.site-description {
font-size: 0.7rem;
}
.favicon-placeholder {
font-size: 1.1rem;
}
.modal-content {
width: 96%;
margin: 16px;
}
.add-site-btn {
padding: 8px 16px;
font-size: 0.92rem;
}
}
.toast {
position: fixed;
bottom: 20px;
right: 20px;
background: white;
color: var(--dark-color);
padding: 12px 20px;
border-radius: 50px;
box-shadow: 0 5px 18px rgba(0, 0, 0, 0.15);
display: flex;
align-items: center;
gap: 10px;
z-index: 2000;
transform: translateX(320px);
transition: transform 0.25s ease;
font-weight: 500;
}
.toast.show {
transform: translateX(0);
}
.toast.success {
border-left: 4px solid var(--success-color);
}
.toast.error {
border-left: 4px solid #f72585;
}
.toast-icon {
font-size: 1.2rem;
}
.category-selector {
display: none;
}
.category-filter {
padding: 5px 12px;
border-radius: 30px;
background: white;
border: 1px solid #ddd;
cursor: pointer;
transition: var(--transition);
font-weight: 500;
font-size: 0.85rem;
}
.category-filter.active {
background: var(--primary-color);
color: white;
border-color: var(--primary-color);
}
.category-filter:hover:not(.active) {
background: #f8fafc;
border-color: var(--primary-color);
}
.no-results {
text-align: center;
padding: 30px 20px;
color: var(--gray-color);
grid-column: 1 / -1;
}
.no-results p {
font-size: 1.05rem;
margin-top: 12px;
}
.favicon-placeholder {
background: linear-gradient(45deg, #4361ee, #3f37c9);
color: white;
font-weight: bold;
font-size: 1.4rem;
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
}