tblog/templates/magine/static/css/style.css
zhang-pu 2a5bdcbc4e 首次上传 tblog 博客项目完整代码
包含后台管理、前端页面和数据库文件
2026-06-01 10:08:11 +08:00

561 lines
9.4 KiB
CSS

:root {
--bg: #0a0a0f;
--surface: #12121a;
--surface-hover: #1a1a25;
--border: #2a2a3a;
--text: #e0e0e8;
--text-secondary: #8888a0;
--accent: #4ade80;
--accent2: #38bdf8;
--shadow: 0 2px 8px rgba(0,0,0,0.4);
--radius: 12px;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
background: var(--bg);
color: var(--text);
line-height: 1.6;
}
a {
color: var(--accent);
text-decoration: none;
transition: color 0.2s;
}
a:hover {
color: #86efac;
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 0 20px;
}
/* Header */
.site-header {
background: var(--surface);
box-shadow: var(--shadow);
position: sticky;
top: 0;
z-index: 100;
border-bottom: 1px solid var(--border);
}
.header-inner {
display: flex;
align-items: center;
justify-content: space-between;
padding: 16px 0;
}
.logo {
font-size: 20px;
font-weight: 700;
color: var(--accent);
}
.main-nav {
display: flex;
gap: 24px;
}
.main-nav a {
color: var(--text);
font-weight: 500;
padding: 8px 0;
position: relative;
}
.main-nav a:hover,
.main-nav a.active {
color: var(--accent);
}
.main-nav a::after {
content: '';
position: absolute;
bottom: 0;
left: 0;
width: 0;
height: 2px;
background: var(--accent);
transition: width 0.2s;
}
.main-nav a:hover::after,
.main-nav a.active::after {
width: 100%;
}
.admin-link {
color: var(--text-secondary) !important;
font-size: 14px;
}
.mobile-menu-btn {
display: none;
background: none;
border: none;
font-size: 24px;
cursor: pointer;
color: var(--text);
}
/* Content Layout */
.main-content {
padding: 40px 0;
}
.content-wrapper {
display: grid;
grid-template-columns: 1fr 300px;
gap: 40px;
}
.main-area {
min-width: 0;
}
.sidebar-area {
display: flex;
flex-direction: column;
gap: 24px;
}
/* Post Card */
.post-card {
background: var(--surface);
padding: 24px;
border-radius: var(--radius);
margin-bottom: 20px;
box-shadow: var(--shadow);
border: 1px solid var(--border);
transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.post-card:hover {
transform: translateY(-2px);
box-shadow: 0 4px 16px rgba(0,0,0,0.5);
border-color: var(--accent);
}
.post-meta {
display: flex;
align-items: center;
gap: 12px;
margin-bottom: 12px;
font-size: 14px;
color: var(--text-secondary);
}
.category-tag {
background: var(--accent);
color: #0a0a0f;
padding: 4px 12px;
border-radius: 20px;
font-size: 12px;
font-weight: 600;
}
.category-tag:hover {
background: #86efac;
color: #0a0a0f;
}
.post-title {
font-size: 20px;
margin-bottom: 12px;
}
.post-title a {
color: var(--text);
}
.post-title a:hover {
color: var(--accent);
}
.post-excerpt {
color: var(--text-secondary);
line-height: 1.7;
}
/* Sidebar Widgets */
.sidebar-widget {
background: var(--surface);
padding: 20px;
border-radius: var(--radius);
box-shadow: var(--shadow);
border: 1px solid var(--border);
}
.sidebar-widget h3 {
font-size: 16px;
margin-bottom: 16px;
padding-bottom: 12px;
border-bottom: 2px solid var(--accent);
}
.category-list,
.recent-list {
list-style: none;
}
.category-list li a,
.recent-list li a {
display: flex;
justify-content: space-between;
padding: 10px 0;
color: var(--text);
border-bottom: 1px solid var(--border);
}
.category-list li:last-child a,
.recent-list li:last-child a {
border-bottom: none;
}
.category-list li a:hover,
.recent-list li a:hover {
color: var(--accent);
}
.cat-count {
background: var(--bg);
padding: 2px 8px;
border-radius: 10px;
font-size: 12px;
color: var(--text-secondary);
}
/* Single Post */
.post-single {
background: var(--surface);
padding: 40px;
border-radius: var(--radius);
box-shadow: var(--shadow);
border: 1px solid var(--border);
}
.post-header {
margin-bottom: 32px;
padding-bottom: 24px;
border-bottom: 1px solid var(--border);
}
.post-header .post-meta {
margin-bottom: 16px;
}
.post-header .post-title {
font-size: 32px;
margin-bottom: 0;
}
.post-content {
line-height: 1.8;
font-size: 16px;
}
.post-content p {
margin-bottom: 16px;
}
/* Comments */
.comments-section {
margin-top: 40px;
}
.comments-section h3 {
font-size: 20px;
margin-bottom: 24px;
}
.comment-list {
margin-bottom: 40px;
}
.comment-item {
background: var(--surface);
padding: 20px;
border-radius: var(--radius);
margin-bottom: 16px;
border: 1px solid var(--border);
}
.comment-author {
font-weight: 600;
color: var(--accent);
}
.comment-date {
font-size: 12px;
color: var(--text-secondary);
margin: 4px 0 12px;
}
.comment-form {
background: var(--surface);
padding: 24px;
border-radius: var(--radius);
box-shadow: var(--shadow);
border: 1px solid var(--border);
}
.comment-form h4 {
margin-bottom: 16px;
}
.comment-form .form-row {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 16px;
}
.comment-form input,
.comment-form textarea {
width: 100%;
padding: 12px 16px;
border: 2px solid var(--border);
border-radius: 8px;
font-size: 14px;
margin-bottom: 16px;
transition: border-color 0.2s;
font-family: inherit;
background: var(--bg);
color: var(--text);
}
.comment-form input:focus,
.comment-form textarea:focus {
outline: none;
border-color: var(--accent);
}
.btn-submit {
background: var(--accent);
color: #0a0a0f;
border: none;
padding: 12px 32px;
border-radius: 8px;
font-size: 14px;
font-weight: 600;
cursor: pointer;
transition: background 0.2s;
}
.btn-submit:hover {
background: #86efac;
}
.comment-success {
background: rgba(74, 222, 128, 0.15);
color: var(--accent);
padding: 12px 16px;
border-radius: 8px;
margin-bottom: 16px;
border: 1px solid var(--accent);
}
.comment-error {
background: rgba(248, 113, 113, 0.15);
color: #f87171;
padding: 12px 16px;
border-radius: 8px;
margin-bottom: 16px;
border: 1px solid #f87171;
}
.no-comments {
color: var(--text-secondary);
text-align: center;
padding: 40px 0;
}
/* Pagination */
.pagination {
display: flex;
justify-content: center;
align-items: center;
gap: 8px;
margin-top: 32px;
}
.pagination a {
display: inline-block;
padding: 8px 16px;
background: var(--surface);
border-radius: 8px;
color: var(--text);
box-shadow: var(--shadow);
border: 1px solid var(--border);
transition: all 0.2s;
}
.pagination a:hover {
background: var(--accent);
color: #0a0a0f;
border-color: var(--accent);
}
.pagination a.active {
background: var(--accent);
color: #0a0a0f;
border-color: var(--accent);
}
/* Archive */
.archive-header {
margin-bottom: 32px;
}
.archive-stats {
color: var(--text-secondary);
margin-top: 8px;
}
.archive-year {
margin-bottom: 32px;
}
.year-title {
font-size: 28px;
color: var(--accent);
margin-bottom: 16px;
}
.archive-month {
margin-bottom: 24px;
padding-left: 20px;
}
.month-title {
font-size: 18px;
color: var(--text-secondary);
margin-bottom: 12px;
}
.archive-list {
list-style: none;
}
.archive-list li {
display: flex;
align-items: center;
padding: 8px 0;
border-bottom: 1px solid var(--border);
}
.archive-date {
color: var(--text-secondary);
font-size: 14px;
width: 60px;
flex-shrink: 0;
}
.archive-title {
color: var(--text);
}
.archive-title:hover {
color: var(--accent);
}
/* Category Header */
.category-header {
background: var(--surface);
padding: 32px;
border-radius: var(--radius);
margin-bottom: 24px;
box-shadow: var(--shadow);
border: 1px solid var(--border);
}
.category-desc {
color: var(--text-secondary);
margin-top: 12px;
}
/* Empty State */
.empty-state {
background: var(--surface);
padding: 60px 20px;
text-align: center;
border-radius: var(--radius);
color: var(--text-secondary);
border: 1px solid var(--border);
}
/* Footer */
.site-footer {
background: var(--surface);
padding: 24px 0;
text-align: center;
color: var(--text-secondary);
margin-top: 60px;
border-top: 1px solid var(--border);
}
/* Responsive */
@media (max-width: 900px) {
.content-wrapper {
grid-template-columns: 1fr;
}
.sidebar-area {
order: 2;
}
.main-area {
order: 1;
}
}
@media (max-width: 600px) {
.main-nav {
display: none;
position: absolute;
top: 100%;
left: 0;
right: 0;
background: var(--surface);
flex-direction: column;
padding: 16px;
gap: 12px;
box-shadow: var(--shadow);
border-top: 1px solid var(--border);
}
.main-nav.show {
display: flex;
}
.mobile-menu-btn {
display: block;
}
.header-inner {
position: relative;
}
.post-header .post-title {
font-size: 24px;
}
.post-single {
padding: 24px;
}
.comment-form .form-row {
grid-template-columns: 1fr;
}
}