Files
ushort/static/style.css
T
2026-03-18 02:38:47 +08:00

693 lines
18 KiB
CSS

/* ================================================================
URL Shortener — style.css
Design language: matches navpage (Syne + JetBrains Mono, teal accent,
surface-based dark/light theming, glass-morphism header, dot-grid bg)
================================================================ */
/* Fonts — Google Fonts fallback for standalone / dev use.
For strict local-serve, replace with local @font-face from
navpage/fetch_fonts.py or self-hosted woff2 files.
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=JetBrains+Mono:ital,wght@0,300;0,400;0,500;0,600;1,300&display=swap');
*/
/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
a { text-decoration: none; color: inherit; }
svg { display: block; flex-shrink: 0; }
ul, ol { list-style: none; }
input, select { font: inherit; }
/* --- Tokens (dark default) --- */
:root {
color-scheme: dark;
--bg: #121212;
--bg-rgb: 18, 18, 18;
--surface: #1e1e1e;
--surface-2: #272727;
--surface-3: #323232;
--border: rgba(255, 255, 255, 0.12);
--border-hi: rgba(255, 255, 255, 0.24);
--fg: #e6e1e5;
--fg-2: #cac4d0;
--fg-3: #79747e;
--accent: #2dd4bf;
--accent-rgb: 45, 212, 191;
--accent-dim: rgba(45, 212, 191, 0.15);
--accent-glow: rgba(45, 212, 191, 0.18);
--danger: #f87171;
--danger-dim: rgba(248, 113, 113, 0.15);
--shadow-sm: 0 1px 2px rgba(0,0,0,0.35);
--shadow: 0 2px 8px rgba(0,0,0,0.30), 0 1px 2px rgba(0,0,0,0.35);
--shadow-lg: 0 8px 28px rgba(0,0,0,0.40), 0 2px 6px rgba(0,0,0,0.30);
--radius: 12px;
--radius-sm: 8px;
--radius-xs: 6px;
--font-ui: 'Syne', 'Noto Sans SC', system-ui, sans-serif;
--font-mono: 'JetBrains Mono', 'Noto Sans SC', 'Cascadia Code', 'Fira Code', monospace;
--ease: cubic-bezier(0.4, 0, 0.2, 1);
--dur: 180ms;
}
/* --- Light (prefers-color-scheme) --- */
@media (prefers-color-scheme: light) {
:root {
color-scheme: light;
--bg: #eeeef2;
--bg-rgb: 238, 238, 242;
--surface: #ffffff;
--surface-2: #f4f4f8;
--surface-3: #e8e8ee;
--border: rgba(0, 0, 0, 0.07);
--border-hi: rgba(0, 0, 0, 0.14);
--fg: #16161e;
--fg-2: #5a5a6e;
--fg-3: #9898aa;
--accent: #0d9488;
--accent-rgb: 13, 148, 136;
--accent-dim: rgba(13, 148, 136, 0.1);
--accent-glow: rgba(13, 148, 136, 0.14);
--danger: #dc2626;
--danger-dim: rgba(220, 38, 38, 0.1);
--shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
--shadow: 0 2px 8px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
--shadow-lg: 0 8px 28px rgba(0,0,0,0.1), 0 2px 6px rgba(0,0,0,0.06);
}
}
/* --- data-theme overrides --- */
:root[data-theme="light"] {
color-scheme: light;
--bg: #eeeef2;
--bg-rgb: 238, 238, 242;
--surface: #ffffff;
--surface-2: #f4f4f8;
--surface-3: #e8e8ee;
--border: rgba(0, 0, 0, 0.07);
--border-hi: rgba(0, 0, 0, 0.14);
--fg: #16161e;
--fg-2: #5a5a6e;
--fg-3: #9898aa;
--accent: #0d9488;
--accent-rgb: 13, 148, 136;
--accent-dim: rgba(13, 148, 136, 0.1);
--accent-glow: rgba(13, 148, 136, 0.14);
--danger: #dc2626;
--danger-dim: rgba(220, 38, 38, 0.1);
--shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
--shadow: 0 2px 8px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
--shadow-lg: 0 8px 28px rgba(0,0,0,0.1), 0 2px 6px rgba(0,0,0,0.06);
}
:root[data-theme="dark"] {
color-scheme: dark;
--bg: #121212;
--bg-rgb: 18, 18, 18;
--surface: #1e1e1e;
--surface-2: #272727;
--surface-3: #323232;
--border: rgba(255, 255, 255, 0.12);
--border-hi: rgba(255, 255, 255, 0.24);
--fg: #e6e1e5;
--fg-2: #cac4d0;
--fg-3: #79747e;
--accent: #2dd4bf;
--accent-rgb: 45, 212, 191;
--accent-dim: rgba(45, 212, 191, 0.15);
--accent-glow: rgba(45, 212, 191, 0.18);
--danger: #f87171;
--danger-dim: rgba(248, 113, 113, 0.15);
--shadow-sm: 0 1px 2px rgba(0,0,0,0.35);
--shadow: 0 2px 8px rgba(0,0,0,0.30), 0 1px 2px rgba(0,0,0,0.35);
--shadow-lg: 0 8px 28px rgba(0,0,0,0.40), 0 2px 6px rgba(0,0,0,0.30);
}
/* --- Base --- */
html { font-size: 16px; height: 100%; }
body {
font-family: var(--font-mono);
font-size: 14px;
background: var(--bg);
color: var(--fg);
min-height: 100vh;
line-height: 1.6;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
#bg {
position: fixed;
inset: 0;
z-index: 0;
pointer-events: none;
overflow: hidden;
color: var(--fg);
}
/* ================================================================
HEADER
================================================================ */
header {
position: sticky;
top: 0;
z-index: 100;
display: flex;
align-items: center;
justify-content: flex-start;
gap: 16px;
padding: 0 28px;
height: 58px;
background: rgba(var(--bg-rgb), 0.82);
backdrop-filter: blur(20px) saturate(1.6);
-webkit-backdrop-filter: blur(20px) saturate(1.6);
border-bottom: 1px solid var(--border);
transition: background var(--dur) var(--ease);
}
.logo {
display: flex;
align-items: center;
gap: 9px;
flex-shrink: 0;
user-select: none;
}
.logo-glyph { font-size: 20px; color: var(--accent); line-height: 1; letter-spacing: -0.02em; }
.logo-name {
font-family: var(--font-ui);
font-weight: 800;
font-size: 17px;
letter-spacing: 0.06em;
text-transform: uppercase;
color: var(--fg);
}
.header-right { display: flex; align-items: center; gap: 10px; margin-left: auto; min-width: 0; }
/* Theme toggle */
.theme-toggle {
display: flex;
align-items: center;
justify-content: center;
width: 34px;
height: 34px;
flex-shrink: 0;
border-radius: var(--radius-xs);
border: 1px solid var(--border);
color: var(--fg-2);
background: transparent;
transition:
border-color var(--dur) var(--ease),
color var(--dur) var(--ease),
background var(--dur) var(--ease),
transform 100ms var(--ease);
}
.theme-toggle:hover { border-color: var(--border-hi); color: var(--accent); background: var(--surface-2); }
.theme-toggle:active { transform: scale(0.9); transition-duration: 60ms; }
/* API key input */
.api-key-wrap {
display: flex;
align-items: center;
gap: 6px;
padding: 5px 12px 5px 10px;
background: var(--surface);
border: 1px solid var(--border);
border-radius: 99px;
transition:
border-color var(--dur) var(--ease),
box-shadow var(--dur) var(--ease);
}
.api-key-wrap:focus-within {
border-color: var(--accent);
box-shadow: 0 0 0 3px var(--accent-glow);
}
.key-icon { color: var(--fg-3); flex-shrink: 0; }
.api-key-input {
width: 100px;
border: none;
outline: none;
background: transparent;
color: var(--fg);
font-family: var(--font-mono);
font-size: 12px;
caret-color: var(--accent);
}
.api-key-input::placeholder { color: var(--fg-3); }
/* ================================================================
MAIN
================================================================ */
main {
position: relative;
z-index: 1;
max-width: 960px;
margin: 0 auto;
padding: 60px 28px 72px;
}
/* ================================================================
URL BAR
================================================================ */
.url-section {
display: flex;
justify-content: center;
margin-bottom: 36px;
}
.url-bar {
display: flex;
align-items: center;
gap: 8px;
width: 100%;
max-width: 640px;
padding: 12px 18px;
background: var(--surface);
border: 1px solid var(--border);
border-radius: 99px;
cursor: text;
box-shadow: var(--shadow);
transition:
border-color var(--dur) var(--ease),
box-shadow var(--dur) var(--ease);
}
.url-bar:focus-within {
border-color: var(--accent);
box-shadow: var(--shadow-lg), 0 0 0 3px var(--accent-glow);
}
.url-icon { color: var(--fg-3); display: flex; align-items: center; flex-shrink: 0; }
.url-input {
flex: 1;
min-width: 0;
border: none;
outline: none;
background: transparent;
color: var(--fg);
font-family: var(--font-mono);
font-size: 14px;
caret-color: var(--accent);
}
.url-input::placeholder { color: var(--fg-3); }
.url-status {
font-size: 11px;
color: var(--fg-3);
flex-shrink: 0;
white-space: nowrap;
transition: color var(--dur);
}
.url-status.ok { color: var(--accent); }
.url-status.err { color: var(--danger); }
/* ================================================================
METADATA CARD (single URL result)
================================================================ */
.meta-card {
max-width: 640px;
margin: 0 auto 36px;
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius);
box-shadow: var(--shadow);
overflow: hidden;
animation: fade-up 250ms var(--ease) both;
}
@keyframes fade-up {
from { opacity: 0; transform: translateY(8px); }
to { opacity: 1; transform: translateY(0); }
}
.meta-card .meta-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 12px 18px;
border-bottom: 1px solid var(--border);
background: var(--surface-2);
}
.meta-card .meta-title {
font-family: var(--font-ui);
font-weight: 700;
font-size: 12px;
letter-spacing: 0.1em;
text-transform: uppercase;
color: var(--fg-3);
}
.meta-card .meta-copy-btn {
display: flex;
align-items: center;
gap: 4px;
padding: 4px 10px;
border-radius: 99px;
font-size: 11px;
font-family: var(--font-mono);
color: var(--accent);
border: 1px solid rgba(var(--accent-rgb), 0.3);
background: var(--accent-dim);
cursor: pointer;
transition: background var(--dur), border-color var(--dur);
}
.meta-card .meta-copy-btn:hover {
background: rgba(var(--accent-rgb), 0.25);
border-color: rgba(var(--accent-rgb), 0.5);
}
.meta-table {
width: 100%;
border-collapse: collapse;
}
.meta-table tr { border-bottom: 1px solid var(--border); }
.meta-table tr:last-child { border-bottom: none; }
.meta-table th {
text-align: left;
padding: 10px 18px;
width: 130px;
font-family: var(--font-ui);
font-weight: 600;
font-size: 12px;
color: var(--fg-3);
letter-spacing: 0.04em;
vertical-align: top;
white-space: nowrap;
}
.meta-table td {
padding: 10px 18px;
font-size: 13px;
color: var(--fg-2);
word-break: break-all;
}
.meta-table td a {
color: var(--accent);
text-decoration: none;
transition: opacity var(--dur);
}
.meta-table td a:hover { opacity: 0.8; text-decoration: underline; }
/* ================================================================
ADMIN TABLE
================================================================ */
.admin-panel {
animation: fade-up 250ms var(--ease) both;
}
.admin-panel-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 14px;
padding-bottom: 10px;
border-bottom: 1px solid var(--border);
}
.admin-panel-title {
font-family: var(--font-ui);
font-weight: 700;
font-size: 11px;
letter-spacing: 0.14em;
text-transform: uppercase;
color: var(--accent);
}
.admin-panel-count {
font-size: 11px;
color: var(--fg-3);
letter-spacing: 0.02em;
}
.admin-table-wrap {
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius);
box-shadow: var(--shadow);
overflow: hidden;
}
.admin-table {
width: 100%;
border-collapse: collapse;
table-layout: fixed;
}
.admin-table thead th {
position: sticky;
top: 0;
padding: 10px 14px;
font-family: var(--font-ui);
font-weight: 600;
font-size: 11px;
letter-spacing: 0.08em;
text-transform: uppercase;
color: var(--fg-3);
background: var(--surface-2);
border-bottom: 1px solid var(--border);
text-align: left;
cursor: pointer;
user-select: none;
white-space: nowrap;
transition: color var(--dur);
}
.admin-table thead th:hover { color: var(--fg); }
.admin-table thead th.sorted { color: var(--accent); }
.admin-table thead th .sort-arrow {
display: inline-block;
margin-left: 4px;
font-size: 10px;
opacity: 0.5;
transition: opacity var(--dur);
}
.admin-table thead th.sorted .sort-arrow { opacity: 1; }
.admin-table thead th.no-sort { cursor: default; }
.admin-table thead th.no-sort:hover { color: var(--fg-3); }
/* Column widths */
.admin-table .col-short { width: 22%; }
.admin-table .col-original { width: 34%; }
.admin-table .col-visits { width: 8%; text-align: right; }
.admin-table .col-created { width: 14%; }
.admin-table .col-retention{ width: 10%; text-align: right; }
.admin-table .col-actions { width: 12%; text-align: right; }
.admin-table tbody tr {
border-bottom: 1px solid var(--border);
transition: background var(--dur);
}
.admin-table tbody tr:last-child { border-bottom: none; }
.admin-table tbody tr:hover { background: var(--surface-2); }
.admin-table td {
padding: 9px 14px;
font-size: 12px;
color: var(--fg-2);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
vertical-align: middle;
}
.admin-table td.r { text-align: right; }
.admin-table td a {
color: var(--accent);
transition: opacity var(--dur);
}
.admin-table td a:hover { opacity: 0.8; text-decoration: underline; }
.admin-table td .original-url {
color: var(--fg-2);
font-style: italic;
font-weight: 300;
}
/* Row actions */
.row-actions {
display: flex;
align-items: center;
justify-content: flex-end;
gap: 4px;
opacity: 0;
transition: opacity var(--dur);
}
.admin-table tbody tr:hover .row-actions { opacity: 1; }
.btn-icon {
display: flex;
align-items: center;
justify-content: center;
width: 28px;
height: 28px;
border-radius: var(--radius-xs);
border: 1px solid var(--border);
color: var(--fg-3);
background: transparent;
transition:
border-color var(--dur),
color var(--dur),
background var(--dur),
transform 100ms var(--ease);
}
.btn-icon:hover {
border-color: var(--border-hi);
color: var(--accent);
background: var(--surface-3);
}
.btn-icon:active { transform: scale(0.9); }
.btn-icon.btn-delete:hover {
color: var(--danger);
border-color: var(--danger);
background: var(--danger-dim);
}
/* ================================================================
PAGINATION
================================================================ */
.pagination {
display: flex;
align-items: center;
justify-content: space-between;
padding: 10px 14px;
border-top: 1px solid var(--border);
background: var(--surface-2);
font-size: 11px;
color: var(--fg-3);
}
.pagination-info {
letter-spacing: 0.02em;
}
.pagination-controls {
display: flex;
align-items: center;
gap: 6px;
}
.pagination-btn {
display: flex;
align-items: center;
justify-content: center;
min-width: 28px;
height: 28px;
padding: 0 8px;
border-radius: var(--radius-xs);
border: 1px solid var(--border);
color: var(--fg-2);
font-size: 11px;
font-family: var(--font-mono);
background: transparent;
cursor: pointer;
transition:
border-color var(--dur),
color var(--dur),
background var(--dur);
}
.pagination-btn:hover:not(:disabled) {
border-color: var(--border-hi);
color: var(--fg);
background: var(--surface-3);
}
.pagination-btn:disabled {
opacity: 0.35;
cursor: default;
}
.pagination-btn.active {
border-color: var(--accent);
color: var(--accent);
background: var(--accent-dim);
}
.page-size-select {
padding: 4px 8px;
border-radius: var(--radius-xs);
border: 1px solid var(--border);
background: var(--surface);
color: var(--fg-2);
font-family: var(--font-mono);
font-size: 11px;
outline: none;
cursor: pointer;
transition: border-color var(--dur);
}
.page-size-select:focus { border-color: var(--accent); }
.page-size-select option { background: var(--surface); color: var(--fg); }
/* ================================================================
EMPTY STATE
================================================================ */
.empty-state {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 140px;
color: var(--fg-3);
font-size: 13px;
text-align: center;
gap: 6px;
letter-spacing: 0.02em;
}
.empty-state svg { opacity: 0.3; margin-bottom: 4px; }
/* ================================================================
TOAST
================================================================ */
.toast {
position: fixed;
bottom: 32px;
left: 50%;
transform: translateX(-50%) translateY(20px);
padding: 8px 20px;
background: var(--surface-3);
border: 1px solid var(--border-hi);
border-radius: 99px;
font-size: 12px;
font-family: var(--font-mono);
color: var(--fg);
box-shadow: var(--shadow-lg);
opacity: 0;
pointer-events: none;
z-index: 1000;
transition:
opacity 200ms var(--ease),
transform 200ms var(--ease);
}
.toast.show {
opacity: 1;
transform: translateX(-50%) translateY(0);
pointer-events: auto;
}
/* ================================================================
FOOTER
================================================================ */
footer {
position: relative;
z-index: 1;
text-align: center;
padding: 24px 28px 32px;
border-top: 1px solid var(--border);
color: var(--fg-3);
font-size: 11px;
letter-spacing: 0.04em;
}
/* ================================================================
RESPONSIVE
================================================================ */
@media (max-width: 640px) {
header { flex-wrap: wrap; height: auto; padding: 10px 16px; gap: 10px; }
.header-right { width: 100%; order: 3; margin-left: 0; justify-content: flex-end; }
main { padding: 30px 16px 56px; }
.url-bar { padding: 10px 14px; }
.url-input { font-size: 13px; }
.api-key-input { width: 80px; }
.admin-table-wrap { overflow-x: auto; }
.admin-table { min-width: 700px; }
.meta-table th { width: 100px; padding: 8px 12px; }
.meta-table td { padding: 8px 12px; }
footer { padding: 20px 16px 28px; }
}
@media (min-width: 641px) and (max-width: 960px) {
main { max-width: 800px; }
}
/* ================================================================
SCROLLBAR & SELECTION
================================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--fg-3); }
::selection { background: var(--accent-dim); color: var(--fg); }