Files
PoemClassify/frontend/style.css
2026-03-23 22:31:48 +08:00

1027 lines
19 KiB
CSS

/* 古诗词阅读网 - 样式表 */
:root {
--ink: #2c2416;
--ink-light: #5a4e3c;
--ink-muted: #8c7e6a;
--ink-faint: #b8ad9a;
--paper: #faf8f5;
--paper-warm: #f5f1eb;
--paper-deep: #ede8df;
--card: #ffffff;
--accent: #8b4513;
--accent-light: #a0522d;
--accent-soft: rgba(139, 69, 19, 0.08);
--green: #2d6a4f;
--green-soft: rgba(45, 106, 79, 0.1);
--amber: #b8860b;
--amber-soft: rgba(184, 134, 11, 0.1);
--border: #e8e2d8;
--shadow: 0 2px 8px rgba(44, 36, 22, 0.08);
--shadow-lg: 0 8px 30px rgba(44, 36, 22, 0.12);
--radius: 10px;
--radius-lg: 16px;
--font-serif: 'Noto Serif SC', 'Songti SC', 'SimSun', serif;
--font-sans: 'Noto Sans SC', 'Microsoft YaHei', sans-serif;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: var(--font-sans);
background: var(--paper);
color: var(--ink);
line-height: 1.6;
min-height: 100vh;
}
/* Header */
.header {
background: var(--ink);
color: var(--paper);
position: sticky;
top: 0;
z-index: 100;
border-bottom: 3px solid var(--accent);
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.header-inner {
max-width: 1440px;
margin: 0 auto;
padding: 0 2rem;
height: 64px;
display: flex;
align-items: center;
justify-content: space-between;
}
.brand {
display: flex;
align-items: center;
gap: 1rem;
}
.brand-icon {
width: 40px;
height: 40px;
background: var(--accent);
border-radius: 6px;
display: flex;
align-items: center;
justify-content: center;
font-family: var(--font-serif);
font-size: 1.3rem;
font-weight: 700;
flex-shrink: 0;
}
.brand h1 {
font-family: var(--font-serif);
font-size: 1.2rem;
font-weight: 600;
white-space: nowrap;
}
.tagline {
font-size: 0.73rem;
opacity: 0.5;
letter-spacing: 0.15em;
margin-top: 1px;
}
.nav {
display: flex;
gap: 0.25rem;
flex-shrink: 0;
}
.nav-item {
padding: 0.45rem 1rem;
color: rgba(250, 248, 245, 0.6);
text-decoration: none;
font-size: 0.87rem;
font-weight: 500;
border-radius: 6px;
transition: 0.2s;
white-space: nowrap;
}
.nav-item:hover {
color: var(--paper);
background: rgba(250, 248, 245, 0.08);
}
.nav-item.active {
color: var(--paper);
background: var(--accent);
}
/* Main Layout */
.main {
max-width: 1440px;
margin: 0 auto;
padding: 1.5rem 2rem;
display: grid;
grid-template-columns: 300px 1fr;
gap: 1.5rem;
min-height: calc(100vh - 64px);
}
/* Sidebar */
.sidebar {
display: flex;
flex-direction: column;
gap: 1rem;
position: sticky;
top: calc(64px + 1.5rem);
max-height: calc(100vh - 64px - 3rem);
overflow-y: auto;
}
.sidebar::-webkit-scrollbar {
width: 6px;
}
.sidebar::-webkit-scrollbar-thumb {
background: var(--border);
border-radius: 3px;
}
.card {
background: var(--card);
border: 1px solid var(--border);
border-radius: var(--radius-lg);
padding: 1.25rem;
flex-shrink: 0;
}
.card-title {
font-family: var(--font-serif);
font-size: 0.93rem;
font-weight: 600;
margin-bottom: 0.9rem;
padding-bottom: 0.6rem;
border-bottom: 1px solid var(--paper-deep);
}
/* Stats */
.stats-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 0.5rem;
margin-bottom: 1rem;
}
.stat-item {
text-align: center;
padding: 0.7rem 0.4rem;
border-radius: var(--radius);
background: var(--paper-warm);
}
.stat-item.read { background: var(--green-soft); }
.stat-item.unread { background: var(--amber-soft); }
.stat-value {
display: block;
font-family: var(--font-serif);
font-size: 1.4rem;
font-weight: 700;
color: var(--ink);
line-height: 1.2;
}
.stat-item.read .stat-value { color: var(--green); }
.stat-item.unread .stat-value { color: var(--amber); }
.stat-label {
font-size: 0.73rem;
color: var(--ink-muted);
display: block;
margin-top: 2px;
}
.progress {
margin-top: 0.25rem;
}
.progress-bar {
height: 6px;
background: var(--paper-deep);
border-radius: 3px;
overflow: hidden;
}
.progress-fill {
height: 100%;
background: linear-gradient(90deg, var(--green), #3a7d7b);
transition: width 0.5s;
border-radius: 3px;
}
.progress-text {
display: flex;
justify-content: space-between;
margin-top: 0.5rem;
font-size: 0.75rem;
color: var(--ink-muted);
}
/* Upload */
.upload-area {
border: 2px dashed var(--border);
border-radius: var(--radius);
padding: 1rem;
text-align: center;
margin-bottom: 0.75rem;
position: relative;
transition: 0.2s;
min-height: 80px;
display: flex;
align-items: center;
justify-content: center;
}
.upload-area:hover {
border-color: var(--accent);
background: var(--accent-soft);
}
.upload-area.dragover {
border-color: var(--accent);
background: var(--accent-soft);
}
.upload-area input[type="file"] {
position: absolute;
inset: 0;
opacity: 0;
cursor: pointer;
width: 100%;
height: 100%;
}
.upload-label {
display: flex;
flex-direction: column;
align-items: center;
gap: 0.4rem;
color: var(--ink-muted);
pointer-events: none;
width: 100%;
}
.upload-icon {
width: 24px;
height: 24px;
color: var(--ink-faint);
flex-shrink: 0;
}
.upload-text {
font-size: 0.8rem;
font-weight: 500;
color: var(--ink-light);
}
.upload-hint {
font-size: 0.68rem;
color: var(--ink-faint);
}
.status-msg {
margin-top: 0.5rem;
font-size: 0.75rem;
padding: 0.4rem 0.6rem;
border-radius: 6px;
word-break: break-word;
}
.status-msg:empty { display: none; }
.status-msg.success { background: var(--green-soft); color: var(--green); }
.status-msg.error { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.status-msg.info { background: rgba(74, 111, 165, 0.1); color: #4a6fa5; }
/* Search */
.search-box {
position: relative;
}
.search-icon {
position: absolute;
left: 0.75rem;
top: 50%;
transform: translateY(-50%);
width: 14px;
height: 14px;
color: var(--ink-muted);
flex-shrink: 0;
}
.search-input {
width: 100%;
padding: 0.55rem 0.75rem 0.55rem 2.1rem;
border: 1px solid var(--border);
border-radius: var(--radius);
font-size: 0.85rem;
background: var(--paper-warm);
transition: 0.2s;
font-family: var(--font-sans);
}
.search-input:focus {
outline: none;
border-color: var(--accent);
background: var(--card);
box-shadow: 0 0 0 3px var(--accent-soft);
}
.search-input::placeholder {
color: var(--ink-faint);
}
/* Category Tabs */
.category-tabs {
display: flex;
flex-wrap: wrap;
gap: 0.4rem;
margin-bottom: 0.75rem;
}
.category-tab {
padding: 0.35rem 0.75rem;
background: var(--paper-warm);
border-radius: 20px;
font-size: 0.78rem;
cursor: pointer;
transition: 0.2s;
border: 1px solid transparent;
}
.category-tab:hover {
border-color: var(--accent);
color: var(--accent);
}
.category-tab.active {
background: var(--accent);
color: var(--paper);
}
/* Tag Cloud */
.tag-cloud {
display: flex;
flex-wrap: wrap;
gap: 0.35rem;
margin-bottom: 0.75rem;
max-height: 200px;
overflow-y: auto;
padding: 0.25rem;
}
.tag-cloud::-webkit-scrollbar {
width: 4px;
}
.tag-cloud::-webkit-scrollbar-thumb {
background: var(--border);
border-radius: 2px;
}
.tag-item {
padding: 0.25rem 0.55rem;
background: var(--paper-warm);
border-radius: 20px;
font-size: 0.72rem;
cursor: pointer;
transition: 0.2s;
border: 1px solid transparent;
}
.tag-item:hover {
background: var(--accent-soft);
color: var(--accent);
border-color: var(--accent);
}
/* Selected Filters */
.selected-filters {
display: flex;
flex-wrap: wrap;
gap: 0.35rem;
margin-top: 0.5rem;
min-height: 0;
}
.filter-tag {
display: inline-flex;
align-items: center;
gap: 0.3rem;
padding: 0.2rem 0.45rem;
background: var(--accent-soft);
color: var(--accent);
border-radius: 20px;
font-size: 0.7rem;
border: 1px solid var(--accent);
}
.filter-tag button {
background: none;
border: none;
color: var(--accent);
cursor: pointer;
font-size: 1rem;
line-height: 1;
padding: 0;
display: flex;
align-items: center;
}
.filter-tag button:hover {
color: var(--ink);
}
/* Buttons */
.btn {
padding: 0.55rem 1.1rem;
border: none;
border-radius: var(--radius);
font-size: 0.83rem;
font-weight: 600;
cursor: pointer;
transition: 0.2s;
display: inline-flex;
align-items: center;
justify-content: center;
gap: 0.4rem;
white-space: nowrap;
}
.btn-primary {
background: var(--accent);
color: var(--paper);
}
.btn-primary:hover {
background: var(--accent-light);
box-shadow: var(--shadow);
}
.btn-ghost {
background: transparent;
color: var(--ink-muted);
padding: 0.45rem 0.8rem;
border: 1px solid transparent;
}
.btn-ghost:hover {
color: var(--accent);
background: var(--accent-soft);
border-color: var(--accent-soft);
}
.btn-block {
width: 100%;
}
.btn-sm {
padding: 0.35rem 0.7rem;
font-size: 0.75rem;
}
/* Content */
.content {
min-width: 0;
}
.content-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 1.25rem;
padding-bottom: 1rem;
border-bottom: 1px solid var(--border);
}
.content-header h2 {
font-family: var(--font-serif);
font-size: 1.35rem;
font-weight: 600;
}
.badge {
padding: 0.25rem 0.7rem;
background: var(--paper-deep);
border-radius: 20px;
font-size: 0.78rem;
color: var(--ink-muted);
font-weight: 500;
}
/* Poem Grid */
.poem-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 1rem;
}
/* Poem Card */
.poem-card {
background: var(--card);
border: 1px solid var(--border);
border-radius: var(--radius-lg);
padding: 1.2rem;
cursor: pointer;
transition: all 0.25s;
position: relative;
display: flex;
flex-direction: column;
}
.poem-card::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 3px;
height: 100%;
background: var(--amber);
transition: 0.2s;
border-radius: 3px 0 0 3px;
}
.poem-card.read::before {
background: var(--green);
}
.poem-card:hover {
transform: translateY(-2px);
box-shadow: var(--shadow-lg);
border-color: var(--accent);
background: var(--paper-warm);
}
.poem-card:active {
transform: translateY(0);
}
.poem-card-header {
margin-bottom: 0.7rem;
}
.poem-title {
font-family: var(--font-serif);
font-size: 1.05rem;
font-weight: 600;
margin-bottom: 0.25rem;
line-height: 1.4;
}
.poem-author {
font-size: 0.78rem;
color: var(--ink-muted);
}
.poem-excerpt {
font-family: var(--font-serif);
font-size: 0.85rem;
color: var(--ink-light);
line-height: 1.8;
margin-bottom: 0.8rem;
flex: 1;
}
.poem-tags {
display: flex;
flex-wrap: wrap;
gap: 0.25rem;
margin-bottom: 0.7rem;
}
.tag {
padding: 0.15rem 0.45rem;
border-radius: 20px;
font-size: 0.65rem;
font-weight: 500;
border: 1px solid currentColor;
white-space: nowrap;
}
.tag-genre { background: rgba(107, 76, 138, 0.08); color: #6b4c8a; }
.tag-emotion_tone { background: rgba(160, 82, 45, 0.08); color: #a0522d; }
.tag-season { background: rgba(74, 111, 165, 0.08); color: #4a6fa5; }
.tag-location { background: rgba(45, 106, 79, 0.08); color: #2d6a4f; }
.tag-time_of_day { background: rgba(184, 134, 11, 0.08); color: #b8860b; }
.tag-philosophy { background: rgba(58, 125, 123, 0.08); color: #3a7d7b; }
.tag-nature_scenery { background: rgba(74, 111, 165, 0.08); color: #4a6fa5; }
.tag-plants { background: rgba(45, 106, 79, 0.08); color: #2d6a4f; }
.tag-animals { background: rgba(160, 82, 45, 0.08); color: #a0522d; }
.tag-buildings { background: rgba(139, 69, 19, 0.08); color: #8b4513; }
.tag-social_role { background: rgba(107, 76, 138, 0.08); color: #6b4c8a; }
.tag-technique { background: rgba(184, 134, 11, 0.08); color: #b8860b; }
.tag-rhetoric { background: rgba(160, 82, 45, 0.08); color: #a0522d; }
.tag-colors { background: rgba(184, 134, 11, 0.08); color: #b8860b; }
.tag-sounds { background: rgba(74, 111, 165, 0.08); color: #4a6fa5; }
.tag-solar_terms { background: rgba(184, 134, 11, 0.08); color: #b8860b; }
.tag-festival { background: rgba(184, 134, 11, 0.08); color: #b8860b; }
.tag-life_stage { background: rgba(58, 125, 123, 0.08); color: #3a7d7b; }
.tag-emotions { background: rgba(160, 82, 45, 0.08); color: #a0522d; }
.poem-card-footer {
display: flex;
justify-content: space-between;
align-items: center;
padding-top: 0.75rem;
border-top: 1px solid var(--paper-deep);
margin-top: auto;
}
.read-toggle {
display: flex;
align-items: center;
gap: 0.4rem;
font-size: 0.75rem;
color: var(--ink-muted);
cursor: pointer;
}
.read-toggle input {
width: 14px;
height: 14px;
accent-color: var(--green);
cursor: pointer;
}
/* Pagination */
.pagination {
display: flex;
align-items: center;
justify-content: center;
gap: 1rem;
margin-top: 1.5rem;
padding: 1rem;
}
.page-btn {
display: inline-flex;
align-items: center;
gap: 0.4rem;
padding: 0.55rem 1rem;
background: var(--card);
border: 1px solid var(--border);
border-radius: var(--radius);
font-size: 0.83rem;
font-weight: 500;
color: var(--ink-light);
cursor: pointer;
transition: all 0.2s;
}
.page-btn:hover:not(:disabled) {
border-color: var(--accent);
color: var(--accent);
background: var(--accent-soft);
}
.page-btn:disabled {
cursor: not-allowed;
}
.page-btn svg {
width: 14px;
height: 14px;
}
.page-info {
font-size: 0.85rem;
color: var(--ink-muted);
min-width: 120px;
text-align: center;
}
/* Empty & Loading */
.empty-state {
text-align: center;
padding: 4rem 2rem;
}
.empty-icon svg {
width: 100px;
height: 100px;
margin-bottom: 1.5rem;
opacity: 0.5;
}
.empty-state h3 {
font-family: var(--font-serif);
font-size: 1.15rem;
font-weight: 600;
color: var(--ink-light);
margin-bottom: 0.5rem;
}
.empty-state p {
font-size: 0.85rem;
color: var(--ink-muted);
}
.loading {
text-align: center;
padding: 3rem;
}
.spinner {
width: 32px;
height: 32px;
border: 3px solid var(--border);
border-top-color: var(--accent);
border-radius: 50%;
animation: spin 0.8s linear infinite;
margin: 0 auto 1rem;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
/* Modal */
.modal {
position: fixed;
inset: 0;
z-index: 1000;
display: flex;
align-items: center;
justify-content: center;
padding: 1.5rem;
}
.modal-backdrop {
position: absolute;
inset: 0;
background: rgba(44, 36, 22, 0.5);
backdrop-filter: blur(4px);
}
.modal-panel {
position: relative;
background: var(--card);
border-radius: 20px;
max-width: 680px;
width: 100%;
max-height: 85vh;
overflow: hidden;
display: flex;
flex-direction: column;
box-shadow: 0 20px 60px rgba(44, 36, 22, 0.15);
}
.modal-header {
display: flex;
justify-content: space-between;
align-items: flex-start;
padding: 1.5rem 1.75rem 1rem;
border-bottom: 1px solid var(--paper-deep);
}
.modal-title {
font-family: var(--font-serif);
font-size: 1.35rem;
font-weight: 700;
}
.modal-author {
font-size: 0.85rem;
color: var(--ink-muted);
margin-top: 0.25rem;
}
.modal-close {
background: none;
border: none;
color: var(--ink-muted);
cursor: pointer;
padding: 0.4rem;
border-radius: 6px;
display: flex;
align-items: center;
justify-content: center;
}
.modal-close:hover {
background: var(--paper-warm);
color: var(--ink);
}
.modal-close svg {
width: 18px;
height: 18px;
}
.modal-body {
padding: 1.25rem 1.75rem;
overflow-y: auto;
flex: 1;
}
.modal-content {
background: var(--paper-warm);
border-radius: var(--radius);
padding: 1.2rem 1.5rem;
margin-bottom: 1.25rem;
border-left: 3px solid var(--accent);
}
.modal-content p {
font-family: var(--font-serif);
font-size: 0.98rem;
line-height: 2;
margin-bottom: 0.5rem;
}
.modal-section {
margin-bottom: 1rem;
}
.section-title {
font-family: var(--font-serif);
font-size: 0.9rem;
font-weight: 600;
color: var(--ink-light);
margin-bottom: 0.6rem;
}
.modal-tags {
display: flex;
flex-direction: column;
gap: 0.7rem;
}
.tag-group {
width: 100%;
margin-bottom: 0.5rem;
}
.tag-group-label {
font-size: 0.75rem;
color: var(--ink-muted);
margin-bottom: 0.35rem;
font-weight: 600;
display: block;
}
.tag-group-tags {
display: flex;
flex-wrap: wrap;
gap: 0.3rem;
}
.modal-footer {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1rem 1.75rem;
border-top: 1px solid var(--paper-deep);
}
.read-checkbox {
display: flex;
align-items: center;
gap: 0.4rem;
font-size: 0.85rem;
color: var(--ink-muted);
cursor: pointer;
}
.read-checkbox input {
width: 15px;
height: 15px;
accent-color: var(--green);
}
/* Toast */
.toast {
position: fixed;
bottom: 1.5rem;
right: 1.5rem;
padding: 0.75rem 1.2rem;
border-radius: var(--radius);
color: white;
font-size: 0.85rem;
font-weight: 500;
z-index: 2000;
box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
max-width: 400px;
}
.toast-success { background: #10b981; }
.toast-error { background: #ef4444; }
.toast-info { background: #1e293b; }
/* Responsive */
@media (max-width: 1024px) {
.main {
grid-template-columns: 280px 1fr;
padding: 1rem;
}
.poem-grid {
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
}
@media (max-width: 860px) {
.main {
grid-template-columns: 1fr;
}
.sidebar {
position: static;
max-height: none;
flex-direction: row;
flex-wrap: wrap;
}
.card {
flex: 1;
min-width: 280px;
}
.header-inner {
flex-direction: column;
height: auto;
padding: 1rem 1.5rem;
gap: 0.75rem;
}
.nav {
width: 100%;
justify-content: center;
flex-wrap: wrap;
}
}
@media (max-width: 600px) {
.header-inner {
padding: 0.75rem 1rem;
}
.brand h1 {
font-size: 1.1rem;
}
.tagline {
display: none;
}
.main {
padding: 0.75rem;
}
.sidebar {
gap: 0.75rem;
}
.card {
min-width: 100%;
}
.poem-grid {
grid-template-columns: 1fr;
}
.modal {
padding: 1rem;
}
.modal-panel {
border-radius: var(--radius-lg);
}
}
/* Print */
@media print {
.header, .sidebar { display: none; }
.main { grid-template-columns: 1fr; }
.poem-card { break-inside: avoid; box-shadow: none; border: 1px solid #ccc; }
}
/* Focus */
*:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 2px;
}
*:focus:not(:focus-visible) {
outline: none;
}
/* Selection */
::selection {
background: var(--accent);
color: var(--paper);
}