- Go + Gin + html/template 服务端渲染 - 主页:Google 风格搜索框 + 导航卡片 - 后台:卡片 CRUD、搜索引擎配置、主页背景/标题配置 - 图片上传:支持 jpg/jpeg/png/gif,自动压缩,缩略图参数 ?thumb=1 - 安全:登录日志、修改密码、IP 自动封禁、IP 白名单 - 访问统计:主页访问/卡片点击/搜索追踪、实时流量、IP 统计 - SQLite 存储(modernc.org/sqlite,纯 Go) - 内存 Session + bcrypt 密码哈希
793 lines
12 KiB
CSS
793 lines
12 KiB
CSS
/* ===== Reset & Base ===== */
|
|
*,
|
|
*::before,
|
|
*::after {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
|
|
color: #333;
|
|
background: #f5f5f5;
|
|
line-height: 1.6;
|
|
}
|
|
|
|
a {
|
|
color: #1a73e8;
|
|
text-decoration: none;
|
|
}
|
|
|
|
a:hover {
|
|
text-decoration: underline;
|
|
}
|
|
|
|
/* ===== Home Page ===== */
|
|
.home-container {
|
|
min-height: 100vh;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
padding: 80px 20px 40px;
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
}
|
|
|
|
.home-header {
|
|
text-align: center;
|
|
margin-bottom: 40px;
|
|
}
|
|
|
|
.home-title {
|
|
font-size: 48px;
|
|
font-weight: 700;
|
|
color: #fff;
|
|
letter-spacing: 2px;
|
|
margin-bottom: 8px;
|
|
}
|
|
|
|
.home-subtitle {
|
|
font-size: 16px;
|
|
color: rgba(255, 255, 255, 0.8);
|
|
}
|
|
|
|
/* ===== Search Box ===== */
|
|
.search-box {
|
|
width: 100%;
|
|
max-width: 640px;
|
|
margin-bottom: 60px;
|
|
}
|
|
|
|
.search-box form {
|
|
display: flex;
|
|
background: #fff;
|
|
border-radius: 24px;
|
|
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
|
|
overflow: hidden;
|
|
transition: box-shadow 0.2s;
|
|
}
|
|
|
|
.search-box form:focus-within {
|
|
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
|
|
}
|
|
|
|
.search-input {
|
|
flex: 1;
|
|
border: none;
|
|
outline: none;
|
|
padding: 14px 24px;
|
|
font-size: 16px;
|
|
background: transparent;
|
|
color: #333;
|
|
}
|
|
|
|
.search-input::placeholder {
|
|
color: #aaa;
|
|
}
|
|
|
|
.search-btn {
|
|
border: none;
|
|
background: #667eea;
|
|
color: #fff;
|
|
padding: 14px 28px;
|
|
font-size: 16px;
|
|
cursor: pointer;
|
|
transition: background 0.2s;
|
|
}
|
|
|
|
.search-btn:hover {
|
|
background: #5a6fd6;
|
|
}
|
|
|
|
/* ===== Card Grid ===== */
|
|
.card-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(4, 1fr);
|
|
gap: 20px;
|
|
width: 100%;
|
|
max-width: 960px;
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.card-grid {
|
|
grid-template-columns: repeat(2, 1fr);
|
|
}
|
|
}
|
|
|
|
@media (max-width: 480px) {
|
|
.card-grid {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
}
|
|
|
|
.card-item {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 12px;
|
|
background: #fff;
|
|
border-radius: 12px;
|
|
padding: 16px 20px;
|
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
|
|
transition: transform 0.2s, box-shadow 0.2s;
|
|
text-decoration: none;
|
|
color: #333;
|
|
}
|
|
|
|
.card-item:hover {
|
|
transform: translateY(-4px);
|
|
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
|
|
text-decoration: none;
|
|
}
|
|
|
|
.card-icon {
|
|
flex-shrink: 0;
|
|
width: 40px;
|
|
height: 40px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
.card-emoji {
|
|
font-size: 28px;
|
|
}
|
|
|
|
.card-content {
|
|
min-width: 0;
|
|
}
|
|
|
|
.card-title {
|
|
font-size: 15px;
|
|
font-weight: 600;
|
|
color: #333;
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
}
|
|
|
|
.card-subtitle {
|
|
font-size: 13px;
|
|
color: #999;
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
}
|
|
|
|
/* ===== Home Footer ===== */
|
|
.home-footer {
|
|
margin-top: auto;
|
|
padding-top: 40px;
|
|
}
|
|
|
|
.home-footer a {
|
|
color: rgba(255, 255, 255, 0.5);
|
|
font-size: 13px;
|
|
}
|
|
|
|
.home-footer a:hover {
|
|
color: rgba(255, 255, 255, 0.8);
|
|
text-decoration: none;
|
|
}
|
|
|
|
/* ===== Login Page ===== */
|
|
.login-container {
|
|
min-height: 100vh;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
background: #f5f5f5;
|
|
}
|
|
|
|
.login-card {
|
|
background: #fff;
|
|
border-radius: 12px;
|
|
padding: 40px;
|
|
width: 100%;
|
|
max-width: 400px;
|
|
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
|
|
}
|
|
|
|
.login-title {
|
|
font-size: 24px;
|
|
font-weight: 600;
|
|
text-align: center;
|
|
margin-bottom: 24px;
|
|
color: #333;
|
|
}
|
|
|
|
.login-error {
|
|
background: #fef2f2;
|
|
color: #dc2626;
|
|
padding: 10px 16px;
|
|
border-radius: 8px;
|
|
margin-bottom: 16px;
|
|
font-size: 14px;
|
|
text-align: center;
|
|
}
|
|
|
|
.login-form .form-group {
|
|
margin-bottom: 16px;
|
|
}
|
|
|
|
/* ===== Admin Layout ===== */
|
|
.admin-layout {
|
|
min-height: 100vh;
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
.admin-nav {
|
|
display: flex;
|
|
align-items: center;
|
|
background: #1f2937;
|
|
color: #fff;
|
|
padding: 0 24px;
|
|
height: 56px;
|
|
gap: 24px;
|
|
}
|
|
|
|
.admin-nav-brand {
|
|
font-size: 18px;
|
|
font-weight: 700;
|
|
margin-right: 16px;
|
|
}
|
|
|
|
.admin-nav-links {
|
|
display: flex;
|
|
gap: 4px;
|
|
}
|
|
|
|
.admin-nav-link {
|
|
color: rgba(255, 255, 255, 0.7);
|
|
padding: 8px 16px;
|
|
border-radius: 6px;
|
|
font-size: 14px;
|
|
transition: background 0.2s, color 0.2s;
|
|
text-decoration: none;
|
|
}
|
|
|
|
.admin-nav-link:hover {
|
|
background: rgba(255, 255, 255, 0.1);
|
|
color: #fff;
|
|
text-decoration: none;
|
|
}
|
|
|
|
.admin-nav-link.active {
|
|
background: rgba(255, 255, 255, 0.15);
|
|
color: #fff;
|
|
}
|
|
|
|
.admin-nav-user {
|
|
margin-left: auto;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 12px;
|
|
font-size: 14px;
|
|
color: rgba(255, 255, 255, 0.8);
|
|
}
|
|
|
|
.admin-main {
|
|
flex: 1;
|
|
padding: 32px;
|
|
max-width: 1200px;
|
|
width: 100%;
|
|
margin: 0 auto;
|
|
}
|
|
|
|
.admin-header {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
margin-bottom: 24px;
|
|
}
|
|
|
|
.admin-header h1 {
|
|
font-size: 24px;
|
|
font-weight: 600;
|
|
color: #111;
|
|
}
|
|
|
|
/* ===== Admin Table ===== */
|
|
.admin-table {
|
|
width: 100%;
|
|
border-collapse: collapse;
|
|
background: #fff;
|
|
border-radius: 8px;
|
|
overflow: hidden;
|
|
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
|
|
}
|
|
|
|
.admin-table th,
|
|
.admin-table td {
|
|
padding: 12px 16px;
|
|
text-align: left;
|
|
border-bottom: 1px solid #eee;
|
|
font-size: 14px;
|
|
}
|
|
|
|
.admin-table th {
|
|
background: #f9fafb;
|
|
font-weight: 600;
|
|
color: #555;
|
|
}
|
|
|
|
.admin-table td a {
|
|
color: #1a73e8;
|
|
max-width: 200px;
|
|
display: inline-block;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
white-space: nowrap;
|
|
vertical-align: bottom;
|
|
}
|
|
|
|
.admin-table td.actions {
|
|
white-space: nowrap;
|
|
}
|
|
|
|
/* ===== Buttons ===== */
|
|
.btn {
|
|
display: inline-block;
|
|
padding: 8px 16px;
|
|
border: none;
|
|
border-radius: 6px;
|
|
font-size: 14px;
|
|
cursor: pointer;
|
|
text-align: center;
|
|
transition: background 0.2s, opacity 0.2s;
|
|
text-decoration: none;
|
|
line-height: 1.5;
|
|
}
|
|
|
|
.btn:hover {
|
|
opacity: 0.9;
|
|
text-decoration: none;
|
|
}
|
|
|
|
.btn-primary {
|
|
background: #667eea;
|
|
color: #fff;
|
|
}
|
|
|
|
.btn-primary:hover {
|
|
background: #5a6fd6;
|
|
}
|
|
|
|
.btn-secondary {
|
|
background: #e5e7eb;
|
|
color: #374151;
|
|
}
|
|
|
|
.btn-secondary:hover {
|
|
background: #d1d5db;
|
|
}
|
|
|
|
.btn-danger {
|
|
background: #ef4444;
|
|
color: #fff;
|
|
}
|
|
|
|
.btn-danger:hover {
|
|
background: #dc2626;
|
|
}
|
|
|
|
.btn-sm {
|
|
padding: 4px 10px;
|
|
font-size: 12px;
|
|
}
|
|
|
|
.btn-block {
|
|
display: block;
|
|
width: 100%;
|
|
}
|
|
|
|
/* ===== Forms ===== */
|
|
.form-group {
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.form-group label {
|
|
display: block;
|
|
margin-bottom: 6px;
|
|
font-size: 14px;
|
|
font-weight: 500;
|
|
color: #374151;
|
|
}
|
|
|
|
.form-group input[type="text"],
|
|
.form-group input[type="password"],
|
|
.form-group input[type="url"],
|
|
.form-group select {
|
|
width: 100%;
|
|
padding: 10px 14px;
|
|
border: 1px solid #d1d5db;
|
|
border-radius: 8px;
|
|
font-size: 14px;
|
|
transition: border-color 0.2s;
|
|
outline: none;
|
|
background: #fff;
|
|
}
|
|
|
|
.form-group input:focus,
|
|
.form-group select:focus {
|
|
border-color: #667eea;
|
|
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
|
|
}
|
|
|
|
.form-group input[type="checkbox"] {
|
|
margin-right: 6px;
|
|
width: auto;
|
|
}
|
|
|
|
.input-readonly {
|
|
background: #f3f4f6 !important;
|
|
color: #6b7280;
|
|
cursor: not-allowed;
|
|
}
|
|
|
|
.required {
|
|
color: #ef4444;
|
|
}
|
|
|
|
.form-actions {
|
|
display: flex;
|
|
gap: 12px;
|
|
margin-top: 24px;
|
|
}
|
|
|
|
.form-error {
|
|
background: #fef2f2;
|
|
color: #dc2626;
|
|
padding: 10px 16px;
|
|
border-radius: 8px;
|
|
margin-bottom: 16px;
|
|
font-size: 14px;
|
|
}
|
|
|
|
/* ===== Badges ===== */
|
|
.badge {
|
|
display: inline-block;
|
|
padding: 2px 10px;
|
|
border-radius: 12px;
|
|
font-size: 12px;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.badge-success {
|
|
background: #dcfce7;
|
|
color: #16a34a;
|
|
}
|
|
|
|
.badge-secondary {
|
|
background: #f3f4f6;
|
|
color: #6b7280;
|
|
}
|
|
|
|
.form-success {
|
|
background: #f0fdf4;
|
|
color: #16a34a;
|
|
padding: 10px 16px;
|
|
border-radius: 8px;
|
|
margin-bottom: 16px;
|
|
font-size: 14px;
|
|
}
|
|
|
|
/* ===== Home Page with Background ===== */
|
|
.home-container.has-background {
|
|
position: relative;
|
|
background: none;
|
|
}
|
|
|
|
.home-container.has-background::before {
|
|
content: "";
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
background: rgba(0, 0, 0, 0.35);
|
|
z-index: 0;
|
|
}
|
|
|
|
.home-container.has-background > * {
|
|
position: relative;
|
|
z-index: 1;
|
|
}
|
|
|
|
/* ===== Site Subtitle ===== */
|
|
.site-subtitle {
|
|
font-size: 16px;
|
|
color: rgba(255, 255, 255, 0.8);
|
|
margin-top: 4px;
|
|
}
|
|
|
|
/* ===== Card Icon Image ===== */
|
|
.card-icon-img {
|
|
width: 40px;
|
|
height: 40px;
|
|
object-fit: contain;
|
|
border-radius: 4px;
|
|
}
|
|
|
|
/* ===== Upload Button ===== */
|
|
.upload-btn-wrapper {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
margin-top: 8px;
|
|
}
|
|
|
|
.upload-btn {
|
|
display: inline-block;
|
|
padding: 6px 14px;
|
|
background: #667eea;
|
|
color: #fff;
|
|
border: none;
|
|
border-radius: 6px;
|
|
font-size: 13px;
|
|
cursor: pointer;
|
|
transition: background 0.2s;
|
|
line-height: 1.5;
|
|
}
|
|
|
|
.upload-btn:hover {
|
|
background: #5a6fd6;
|
|
}
|
|
|
|
.upload-btn:disabled {
|
|
opacity: 0.6;
|
|
cursor: not-allowed;
|
|
}
|
|
|
|
.upload-status {
|
|
font-size: 13px;
|
|
margin-left: 4px;
|
|
}
|
|
|
|
.upload-success {
|
|
color: #16a34a;
|
|
}
|
|
|
|
.upload-error {
|
|
color: #dc2626;
|
|
}
|
|
|
|
/* ===== Background Preview ===== */
|
|
.background-preview {
|
|
margin-top: 10px;
|
|
}
|
|
|
|
.upload-preview-img {
|
|
max-width: 320px;
|
|
max-height: 180px;
|
|
border-radius: 8px;
|
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
display: block;
|
|
margin-bottom: 6px;
|
|
}
|
|
|
|
.preview-link {
|
|
font-size: 13px;
|
|
color: #1a73e8;
|
|
}
|
|
|
|
/* ===== Form Section Title ===== */
|
|
.form-section-title {
|
|
font-size: 18px;
|
|
font-weight: 600;
|
|
color: #374151;
|
|
margin: 32px 0 16px;
|
|
padding-bottom: 8px;
|
|
border-bottom: 1px solid #e5e7eb;
|
|
}
|
|
|
|
.form-section-title:first-of-type {
|
|
margin-top: 0;
|
|
}
|
|
|
|
/* ===== Badges — danger variant ===== */
|
|
.badge-danger {
|
|
background: #fef2f2;
|
|
color: #dc2626;
|
|
}
|
|
|
|
/* ===== Pagination ===== */
|
|
.pagination {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 12px;
|
|
margin-top: 20px;
|
|
padding: 12px 0;
|
|
}
|
|
|
|
.pagination-info {
|
|
font-size: 14px;
|
|
color: #6b7280;
|
|
}
|
|
|
|
/* ===== User-Agent cell truncation ===== */
|
|
.ua-cell {
|
|
max-width: 200px;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
white-space: nowrap;
|
|
font-size: 12px;
|
|
color: #9ca3af;
|
|
}
|
|
|
|
/* ===== Code style ===== */
|
|
code {
|
|
background: #f3f4f6;
|
|
padding: 2px 6px;
|
|
border-radius: 4px;
|
|
font-family: "Cascadia Code", "Fira Code", "Consolas", monospace;
|
|
font-size: 13px;
|
|
}
|
|
|
|
/* ===== Admin nav responsive ===== */
|
|
@media (max-width: 900px) {
|
|
.admin-nav {
|
|
flex-wrap: wrap;
|
|
height: auto;
|
|
padding: 8px 16px;
|
|
gap: 8px;
|
|
}
|
|
.admin-nav-links {
|
|
order: 3;
|
|
width: 100%;
|
|
flex-wrap: wrap;
|
|
gap: 2px;
|
|
}
|
|
.admin-nav-link {
|
|
padding: 4px 10px;
|
|
font-size: 13px;
|
|
}
|
|
}
|
|
|
|
/* ===== Whitelist Notice ===== */
|
|
.whitelist-notice {
|
|
background: #fef3c7;
|
|
color: #92400e;
|
|
padding: 12px 16px;
|
|
border-radius: 8px;
|
|
margin-bottom: 20px;
|
|
font-size: 14px;
|
|
border: 1px solid #fbbf24;
|
|
}
|
|
|
|
.whitelist-notice.notice-info {
|
|
background: #eff6ff;
|
|
color: #1e40af;
|
|
border-color: #93c5fd;
|
|
}
|
|
|
|
/* ===== Stats Grid ===== */
|
|
.stats-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(4, 1fr);
|
|
gap: 20px;
|
|
margin-bottom: 32px;
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.stats-grid {
|
|
grid-template-columns: repeat(2, 1fr);
|
|
}
|
|
}
|
|
|
|
.stat-card {
|
|
background: #fff;
|
|
border-radius: 12px;
|
|
padding: 24px;
|
|
text-align: center;
|
|
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
|
|
transition: transform 0.2s, box-shadow 0.2s;
|
|
}
|
|
|
|
.stat-card:hover {
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
.stat-value {
|
|
font-size: 36px;
|
|
font-weight: 700;
|
|
color: #667eea;
|
|
margin-bottom: 4px;
|
|
}
|
|
|
|
.stat-label {
|
|
font-size: 14px;
|
|
color: #6b7280;
|
|
}
|
|
|
|
/* ===== Badge Variants ===== */
|
|
.badge-primary {
|
|
background: #eff6ff;
|
|
color: #2563eb;
|
|
}
|
|
|
|
.badge-warning {
|
|
background: #fffbeb;
|
|
color: #d97706;
|
|
}
|
|
|
|
/* ===== Detail Cell ===== */
|
|
.detail-cell {
|
|
max-width: 200px;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
white-space: nowrap;
|
|
font-size: 13px;
|
|
}
|
|
|
|
/* ===== Filter Form ===== */
|
|
.filter-form {
|
|
background: #fff;
|
|
border-radius: 8px;
|
|
padding: 16px 20px;
|
|
margin-bottom: 20px;
|
|
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
|
|
}
|
|
|
|
.filter-row {
|
|
display: flex;
|
|
gap: 16px;
|
|
align-items: flex-end;
|
|
flex-wrap: wrap;
|
|
}
|
|
|
|
.filter-group {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 4px;
|
|
}
|
|
|
|
.filter-group label {
|
|
font-size: 13px;
|
|
font-weight: 500;
|
|
color: #374151;
|
|
}
|
|
|
|
.filter-group input[type="text"],
|
|
.filter-group select {
|
|
padding: 6px 12px;
|
|
border: 1px solid #d1d5db;
|
|
border-radius: 6px;
|
|
font-size: 14px;
|
|
outline: none;
|
|
min-width: 160px;
|
|
}
|
|
|
|
.filter-group input:focus,
|
|
.filter-group select:focus {
|
|
border-color: #667eea;
|
|
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
|
|
}
|
|
|
|
.filter-actions-group {
|
|
flex-direction: row;
|
|
align-items: center;
|
|
gap: 8px;
|
|
}
|