fileshare/static/style.css
2025-08-10 12:57:17 +08:00

829 lines
15 KiB
CSS

/* 文件传输服务 - 样式表 */
/* 基础重置和变量 */
:root {
--primary-color: #3b82f6;
--primary-hover: #2563eb;
--success-color: #10b981;
--error-color: #ef4444;
--warning-color: #f59e0b;
--text-primary: #1f2937;
--text-secondary: #6b7280;
--text-muted: #9ca3af;
--bg-primary: #ffffff;
--bg-secondary: #f9fafb;
--bg-tertiary: #f3f4f6;
--border-color: #e5e7eb;
--border-radius: 8px;
--shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
--shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
--shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
--transition: all 0.2s ease-in-out;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
line-height: 1.6;
color: var(--text-primary);
}
/* 容器布局 */
.container {
min-height: 100vh;
display: flex;
flex-direction: column;
}
/* 头部样式 */
header {
text-align: center;
padding: 2rem 1rem 1rem;
color: white;
}
.logo {
display: flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
margin-bottom: 0.5rem;
}
.logo .icon {
font-size: 2rem;
}
.logo h1 {
font-size: 2.5rem;
font-weight: 700;
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.subtitle {
font-size: 1.1rem;
opacity: 0.9;
margin-bottom: 0;
}
/* 主内容区 */
main {
flex: 1;
max-width: 800px;
margin: 0 auto;
padding: 0 1rem;
width: 100%;
}
/* 选项卡导航 */
.tab-nav {
display: flex;
background: var(--bg-primary);
border-radius: var(--border-radius);
padding: 0.25rem;
margin-bottom: 2rem;
box-shadow: var(--shadow-md);
overflow-x: auto;
}
.tab-btn {
flex: 1;
padding: 0.75rem 1rem;
border: none;
background: transparent;
color: var(--text-secondary);
font-weight: 500;
border-radius: calc(var(--border-radius) - 2px);
cursor: pointer;
transition: var(--transition);
white-space: nowrap;
min-width: 120px;
}
.tab-btn:hover {
color: var(--primary-color);
background: var(--bg-secondary);
}
.tab-btn.active {
background: var(--primary-color);
color: white;
box-shadow: var(--shadow-sm);
}
/* 选项卡内容 */
.tab-content {
display: none;
animation: fadeIn 0.3s ease-in-out;
}
.tab-content.active {
display: block;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
/* 文件上传区域 */
.upload-section {
background: var(--bg-primary);
border-radius: var(--border-radius);
padding: 2rem;
box-shadow: var(--shadow-md);
}
.drop-zone {
border: 2px dashed var(--border-color);
border-radius: var(--border-radius);
padding: 3rem 2rem;
text-align: center;
transition: var(--transition);
cursor: pointer;
}
.drop-zone:hover,
.drop-zone.dragover {
border-color: var(--primary-color);
background: var(--bg-secondary);
}
.drop-content .drop-icon {
font-size: 3rem;
margin-bottom: 1rem;
}
.drop-text {
font-size: 1.2rem;
color: var(--text-primary);
margin-bottom: 0.5rem;
}
.drop-hint {
color: var(--text-muted);
margin-bottom: 1.5rem;
}
.select-btn {
background: var(--primary-color);
color: white;
border: none;
padding: 0.75rem 1.5rem;
border-radius: var(--border-radius);
font-weight: 500;
cursor: pointer;
transition: var(--transition);
}
.select-btn:hover {
background: var(--primary-hover);
}
/* 进度条 */
.progress-section {
margin-top: 2rem;
}
.progress-bar {
width: 100%;
height: 8px;
background: var(--bg-tertiary);
border-radius: 4px;
overflow: hidden;
margin-bottom: 1rem;
}
.progress-fill {
height: 100%;
background: var(--success-color);
transition: width 0.3s ease;
border-radius: 4px;
}
.progress-text {
text-align: center;
color: var(--text-secondary);
}
/* 结果卡片 */
.result-section {
margin-top: 2rem;
}
.result-card {
background: var(--bg-secondary);
border-radius: var(--border-radius);
padding: 2rem;
border: 1px solid var(--border-color);
}
.result-header {
display: flex;
align-items: center;
gap: 0.5rem;
margin-bottom: 1.5rem;
}
.success-icon {
font-size: 1.5rem;
}
.result-header h3 {
color: var(--success-color);
font-size: 1.25rem;
}
.share-info {
margin-bottom: 1.5rem;
}
.share-code,
.share-link {
margin-bottom: 1rem;
}
.share-code label,
.share-link label {
display: block;
margin-bottom: 0.5rem;
font-weight: 500;
color: var(--text-secondary);
}
.code-display,
.link-display {
display: flex;
align-items: center;
background: var(--bg-primary);
border: 1px solid var(--border-color);
border-radius: var(--border-radius);
padding: 0.75rem;
gap: 0.5rem;
}
.code-text,
.link-text {
flex: 1;
font-family: 'Courier New', monospace;
font-weight: 600;
color: var(--primary-color);
font-size: 0.9rem;
}
.copy-btn {
background: var(--primary-color);
color: white;
border: none;
padding: 0.5rem;
border-radius: calc(var(--border-radius) - 2px);
cursor: pointer;
transition: var(--transition);
font-size: 0.9rem;
}
.copy-btn:hover {
background: var(--primary-hover);
}
.expire-info {
text-align: center;
padding: 0.75rem;
background: var(--bg-primary);
border-radius: var(--border-radius);
border: 1px solid var(--warning-color);
}
.expire-text {
color: var(--warning-color);
font-weight: 500;
}
.new-upload-btn,
.new-text-btn {
width: 100%;
background: var(--primary-color);
color: white;
border: none;
padding: 0.75rem;
border-radius: var(--border-radius);
font-weight: 500;
cursor: pointer;
transition: var(--transition);
}
.new-upload-btn:hover,
.new-text-btn:hover {
background: var(--primary-hover);
}
/* 文本分享区域 */
.text-section {
background: var(--bg-primary);
border-radius: var(--border-radius);
padding: 2rem;
box-shadow: var(--shadow-md);
}
.text-input-area {
margin-bottom: 2rem;
}
#textContent {
width: 100%;
padding: 1rem;
border: 1px solid var(--border-color);
border-radius: var(--border-radius);
font-family: 'Courier New', monospace;
font-size: 0.9rem;
resize: vertical;
margin-bottom: 1rem;
transition: var(--transition);
}
#textContent:focus {
outline: none;
border-color: var(--primary-color);
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.text-controls {
display: flex;
gap: 1rem;
align-items: center;
}
#textFilename {
flex: 1;
padding: 0.75rem;
border: 1px solid var(--border-color);
border-radius: var(--border-radius);
transition: var(--transition);
}
#textFilename:focus {
outline: none;
border-color: var(--primary-color);
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.share-text-btn {
background: var(--primary-color);
color: white;
border: none;
padding: 0.75rem 1.5rem;
border-radius: var(--border-radius);
font-weight: 500;
cursor: pointer;
transition: var(--transition);
white-space: nowrap;
}
.share-text-btn:hover {
background: var(--primary-hover);
}
/* 下载区域 */
.download-section {
background: var(--bg-primary);
border-radius: var(--border-radius);
padding: 2rem;
box-shadow: var(--shadow-md);
}
.download-input {
text-align: center;
margin-bottom: 2rem;
}
.download-input h3 {
margin-bottom: 1.5rem;
color: var(--text-primary);
}
.code-input-group {
display: flex;
max-width: 400px;
margin: 0 auto;
gap: 1rem;
}
#downloadCode {
flex: 1;
padding: 0.75rem;
border: 1px solid var(--border-color);
border-radius: var(--border-radius);
text-align: center;
font-family: 'Courier New', monospace;
font-size: 1.1rem;
font-weight: 600;
text-transform: uppercase;
transition: var(--transition);
}
#downloadCode:focus {
outline: none;
border-color: var(--primary-color);
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.download-btn {
background: var(--primary-color);
color: white;
border: none;
padding: 0.75rem 1.5rem;
border-radius: var(--border-radius);
font-weight: 500;
cursor: pointer;
transition: var(--transition);
white-space: nowrap;
}
.download-btn:hover {
background: var(--primary-hover);
}
.file-info {
margin-top: 2rem;
}
.info-card {
display: flex;
align-items: center;
gap: 1rem;
background: var(--bg-secondary);
border: 1px solid var(--border-color);
border-radius: var(--border-radius);
padding: 1.5rem;
}
.file-icon {
font-size: 2rem;
flex-shrink: 0;
}
.file-details {
flex: 1;
}
.file-details h4 {
margin-bottom: 0.5rem;
color: var(--text-primary);
}
.file-meta {
display: flex;
gap: 1rem;
margin-bottom: 0.5rem;
font-size: 0.9rem;
color: var(--text-secondary);
}
.file-expire {
font-size: 0.9rem;
color: var(--warning-color);
font-weight: 500;
}
.download-file-btn {
background: var(--success-color);
color: white;
border: none;
padding: 0.75rem 1.5rem;
border-radius: var(--border-radius);
font-weight: 500;
cursor: pointer;
transition: var(--transition);
white-space: nowrap;
}
.download-file-btn:hover {
background: #059669;
}
/* 帮助区域 */
.help-section {
background: var(--bg-primary);
border-radius: var(--border-radius);
padding: 2rem;
box-shadow: var(--shadow-md);
}
.help-section h3 {
margin-bottom: 2rem;
text-align: center;
color: var(--text-primary);
}
.help-group {
margin-bottom: 2rem;
}
.help-group h4 {
margin-bottom: 1rem;
color: var(--text-primary);
display: flex;
align-items: center;
gap: 0.5rem;
}
.code-block {
display: flex;
align-items: center;
background: var(--bg-tertiary);
border: 1px solid var(--border-color);
border-radius: var(--border-radius);
padding: 0.75rem 1rem;
margin-bottom: 0.5rem;
gap: 0.5rem;
}
.code-blocks .code-block {
margin-bottom: 0.75rem;
}
.code-label {
font-size: 0.85rem;
color: var(--text-secondary);
margin-right: 0.5rem;
font-weight: 500;
min-width: 100px;
}
.code-block code {
flex: 1;
font-family: 'Courier New', monospace;
font-size: 0.9rem;
color: var(--text-primary);
background: none;
border: none;
font-weight: 500;
}
.copy-code-btn {
background: var(--text-muted);
color: white;
border: none;
padding: 0.25rem 0.5rem;
border-radius: calc(var(--border-radius) - 2px);
cursor: pointer;
transition: var(--transition);
font-size: 0.8rem;
}
.copy-code-btn:hover {
background: var(--text-secondary);
}
.help-desc {
color: var(--text-muted);
font-size: 0.9rem;
margin-top: 0.5rem;
padding-left: 0.5rem;
border-left: 3px solid var(--border-color);
}
.config-table {
overflow-x: auto;
}
.config-table table {
width: 100%;
border-collapse: collapse;
border: 1px solid var(--border-color);
border-radius: var(--border-radius);
overflow: hidden;
}
.config-table th,
.config-table td {
padding: 0.75rem;
text-align: left;
border-bottom: 1px solid var(--border-color);
}
.config-table th {
background: var(--bg-tertiary);
font-weight: 600;
color: var(--text-primary);
}
.config-table td code {
background: var(--bg-tertiary);
padding: 0.25rem 0.5rem;
border-radius: 4px;
font-family: 'Courier New', monospace;
font-size: 0.85rem;
}
/* 页脚 */
footer {
padding: 2rem 1rem 1rem;
text-align: center;
color: white;
margin-top: 2rem;
}
.footer-content {
max-width: 800px;
margin: 0 auto;
}
.footer-content p {
margin-bottom: 0.5rem;
opacity: 0.8;
}
.footer-links {
display: flex;
justify-content: center;
gap: 1rem;
}
.footer-links a {
color: white;
text-decoration: none;
padding: 0.5rem 1rem;
border-radius: var(--border-radius);
transition: var(--transition);
opacity: 0.8;
}
.footer-links a:hover {
opacity: 1;
background: rgba(255, 255, 255, 0.1);
}
/* 通知提示 */
.toast {
position: fixed;
top: 2rem;
right: 2rem;
background: var(--success-color);
color: white;
padding: 1rem 1.5rem;
border-radius: var(--border-radius);
box-shadow: var(--shadow-lg);
z-index: 1000;
animation: slideIn 0.3s ease-out;
}
.toast.error {
background: var(--error-color);
}
.toast.warning {
background: var(--warning-color);
}
@keyframes slideIn {
from { transform: translateX(100%); opacity: 0; }
to { transform: translateX(0); opacity: 1; }
}
/* 响应式设计 */
@media (max-width: 768px) {
.logo h1 {
font-size: 2rem;
}
.tab-nav {
flex-direction: column;
gap: 0.25rem;
}
.tab-btn {
min-width: auto;
}
.upload-section,
.text-section,
.download-section,
.help-section {
padding: 1.5rem;
}
.drop-zone {
padding: 2rem 1rem;
}
.text-controls {
flex-direction: column;
}
.code-input-group {
flex-direction: column;
}
.info-card {
flex-direction: column;
text-align: center;
}
.file-meta {
justify-content: center;
}
.code-block {
flex-direction: column;
align-items: stretch;
gap: 0.5rem;
}
.code-label {
min-width: auto;
margin-right: 0;
}
.toast {
right: 1rem;
left: 1rem;
top: 1rem;
}
.footer-links {
flex-direction: column;
gap: 0.5rem;
}
}
/* 暗色主题支持 */
@media (prefers-color-scheme: dark) {
:root {
--text-primary: #f9fafb;
--text-secondary: #d1d5db;
--text-muted: #9ca3af;
--bg-primary: #1f2937;
--bg-secondary: #374151;
--bg-tertiary: #4b5563;
--border-color: #4b5563;
}
body {
background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}
}
/* 加载状态 */
.loading {
opacity: 0.6;
pointer-events: none;
position: relative;
}
.loading::after {
content: '';
position: absolute;
top: 50%;
left: 50%;
width: 20px;
height: 20px;
margin: -10px 0 0 -10px;
border: 2px solid var(--primary-color);
border-radius: 50%;
border-top-color: transparent;
animation: spin 1s linear infinite;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
/* 错误状态 */
.error-message {
background: var(--error-color);
color: white;
padding: 1rem;
border-radius: var(--border-radius);
margin: 1rem 0;
display: flex;
align-items: center;
gap: 0.5rem;
}
.error-message::before {
content: '❌';
}
/* 成功状态 */
.success-message {
background: var(--success-color);
color: white;
padding: 1rem;
border-radius: var(--border-radius);
margin: 1rem 0;
display: flex;
align-items: center;
gap: 0.5rem;
}
.success-message::before {
content: '✅';
}