Files
thptqg/2016/src/App.css
T
tiennm99 c1cd39e535 feat(ui): refresh styling with design tokens, dark mode, and a11y polish
- Add CSS variables and prefers-color-scheme dark theme
- Color-code score cells (high/low/empty) and add zebra rows
- Add ARIA tablist, search clear button, and focus halos
- Card-style loading, results table, and message blocks
2026-04-14 20:50:57 +07:00

475 lines
8.2 KiB
CSS

.app {
max-width: 1200px;
margin: 0 auto;
padding: 2rem 1rem 3rem;
}
/* Header */
header {
text-align: center;
margin-bottom: 2rem;
}
header h1 {
font-size: clamp(1.4rem, 2.4vw, 2rem);
color: var(--text);
margin: 0 0 0.4rem;
letter-spacing: -0.01em;
font-weight: 700;
}
.subtitle {
color: var(--text-muted);
font-size: 0.95rem;
margin: 0;
}
.subtitle .pill {
display: inline-block;
padding: 0.1rem 0.55rem;
background: var(--accent-soft);
color: var(--accent);
border-radius: 999px;
font-weight: 600;
font-size: 0.8rem;
margin-right: 0.35rem;
}
/* Tabs */
.tabs {
display: flex;
gap: 0;
max-width: 600px;
margin: 0 auto 1.5rem;
border-bottom: 1px solid var(--border);
}
.tab {
flex: 1;
padding: 0.75rem 1rem;
font-size: 0.95rem;
background: none;
border: none;
border-bottom: 2px solid transparent;
margin-bottom: -1px;
cursor: pointer;
color: var(--text-muted);
font-weight: 500;
transition: color 0.15s, border-color 0.15s;
}
.tab:hover {
color: var(--accent);
}
.tab[aria-selected="true"] {
color: var(--accent);
border-bottom-color: var(--accent);
font-weight: 600;
}
/* Search form */
.search-form {
display: flex;
gap: 0.5rem;
max-width: 600px;
margin: 0 auto 1.5rem;
position: relative;
}
.search-field {
flex: 1;
position: relative;
}
.search-form input {
width: 100%;
padding: 0.75rem 2.25rem 0.75rem 1rem;
font-size: 1rem;
border: 1px solid var(--border-strong);
border-radius: var(--radius);
background: var(--surface);
color: var(--text);
outline: none;
transition: border-color 0.15s, box-shadow 0.15s;
}
.search-form input:focus {
border-color: var(--accent);
box-shadow: 0 0 0 3px var(--accent-soft);
}
.search-clear {
position: absolute;
right: 0.4rem;
top: 50%;
transform: translateY(-50%);
width: 1.75rem;
height: 1.75rem;
display: grid;
place-items: center;
border: none;
background: transparent;
color: var(--text-faint);
font-size: 1.1rem;
border-radius: 50%;
cursor: pointer;
}
.search-clear:hover {
background: var(--surface-alt);
color: var(--text);
}
.search-form button[type="submit"] {
padding: 0.75rem 1.5rem;
font-size: 0.95rem;
font-weight: 600;
background: var(--accent);
color: #fff;
border: none;
border-radius: var(--radius);
cursor: pointer;
transition: background 0.15s, transform 0.05s;
}
.search-form button[type="submit"]:hover:not(:disabled) {
background: var(--accent-hover);
}
.search-form button[type="submit"]:active:not(:disabled) {
transform: translateY(1px);
}
.search-form button:disabled {
opacity: 0.5;
cursor: not-allowed;
}
/* Custom query */
.custom-query {
max-width: 960px;
margin: 0 auto;
}
.preset-list {
display: flex;
flex-wrap: wrap;
gap: 0.4rem;
margin-bottom: 0.85rem;
align-items: center;
}
.preset-label {
font-size: 0.8rem;
color: var(--text-muted);
white-space: nowrap;
margin-right: 0.25rem;
font-weight: 500;
}
.preset-btn {
padding: 0.35rem 0.75rem;
font-size: 0.8rem;
background: var(--surface);
border: 1px solid var(--border);
color: var(--text);
border-radius: 999px;
cursor: pointer;
transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.preset-btn:hover:not(:disabled) {
background: var(--accent-soft);
border-color: var(--accent);
color: var(--accent);
}
.preset-btn:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.query-form {
margin-bottom: 1rem;
}
.query-form textarea {
width: 100%;
padding: 0.85rem 1rem;
font-size: 0.9rem;
font-family:
"JetBrains Mono", "Cascadia Code", "Fira Code", ui-monospace, monospace;
background: var(--surface);
color: var(--text);
border: 1px solid var(--border-strong);
border-radius: var(--radius);
outline: none;
resize: vertical;
min-height: 130px;
transition: border-color 0.15s, box-shadow 0.15s;
tab-size: 2;
line-height: 1.5;
}
.query-form textarea:focus {
border-color: var(--accent);
box-shadow: 0 0 0 3px var(--accent-soft);
}
.query-actions {
display: flex;
align-items: center;
gap: 1rem;
margin-top: 0.6rem;
flex-wrap: wrap;
}
.query-actions button {
padding: 0.6rem 1.4rem;
font-size: 0.9rem;
font-weight: 600;
background: var(--accent);
color: #fff;
border: none;
border-radius: var(--radius);
cursor: pointer;
transition: background 0.15s;
}
.query-actions button:hover:not(:disabled) {
background: var(--accent-hover);
}
.query-actions button:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.exec-time {
font-size: 0.85rem;
color: var(--text-muted);
font-variant-numeric: tabular-nums;
}
.exec-time.running {
color: var(--accent);
}
.kbd {
display: inline-block;
padding: 0.05rem 0.4rem;
font-family: ui-monospace, monospace;
font-size: 0.75rem;
background: var(--surface-alt);
border: 1px solid var(--border);
border-bottom-width: 2px;
border-radius: 4px;
color: var(--text-muted);
}
/* Loading */
.loading {
max-width: 600px;
margin: 0.5rem auto 1.5rem;
padding: 0.85rem 1rem;
text-align: center;
color: var(--text-muted);
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius);
box-shadow: var(--shadow-sm);
}
.loading p {
margin: 0 0 0.5rem;
font-size: 0.9rem;
}
.progress-bar {
width: 100%;
max-width: 300px;
height: 6px;
background: var(--surface-alt);
border-radius: 4px;
margin: 0 auto;
overflow: hidden;
}
.progress-fill {
height: 100%;
background: linear-gradient(90deg, var(--accent), var(--accent-hover));
border-radius: 4px;
transition: width 0.3s;
}
/* Results table */
.table-wrapper {
overflow-x: auto;
margin-top: 1rem;
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius);
box-shadow: var(--shadow-sm);
}
.result-count {
color: var(--text-muted);
font-size: 0.9rem;
margin: 0.5rem 0;
padding: 0 0.25rem;
}
table {
width: 100%;
border-collapse: collapse;
font-size: 0.9rem;
}
thead th {
background: var(--surface-alt);
padding: 0.65rem 0.6rem;
text-align: left;
white-space: nowrap;
position: sticky;
top: 0;
border-bottom: 1px solid var(--border-strong);
color: var(--text-muted);
font-weight: 600;
font-size: 0.8rem;
text-transform: uppercase;
letter-spacing: 0.03em;
}
tbody td {
padding: 0.55rem 0.6rem;
border-bottom: 1px solid var(--border);
}
tbody tr:last-child td {
border-bottom: none;
}
tbody tr:nth-child(even) td {
background: color-mix(in srgb, var(--surface-alt) 45%, transparent);
}
tbody tr:hover td {
background: var(--accent-soft);
}
.sbd-cell {
font-family: ui-monospace, monospace;
font-size: 0.85rem;
color: var(--text-muted);
white-space: nowrap;
}
.name-cell {
white-space: nowrap;
font-weight: 500;
}
.cumthi-cell {
font-size: 0.82rem;
color: var(--text-muted);
max-width: 220px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.score-cell {
text-align: center;
font-variant-numeric: tabular-nums;
}
.score-cell.score-high {
color: var(--ok);
font-weight: 600;
}
.score-cell.score-low {
color: var(--danger);
}
.score-cell.score-empty {
color: var(--text-faint);
}
/* Messages */
.no-results,
.error,
.warning {
text-align: center;
padding: 0.9rem 1rem;
border-radius: var(--radius);
margin: 1rem auto;
max-width: 600px;
font-size: 0.9rem;
}
.no-results {
color: var(--text-muted);
background: var(--surface);
border: 1px dashed var(--border-strong);
}
.error {
color: var(--danger);
background: var(--danger-bg);
border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent);
}
.warning {
color: var(--warn);
background: var(--warn-bg);
}
/* Footer */
footer {
text-align: center;
margin-top: 3rem;
padding-top: 1rem;
border-top: 1px solid var(--border);
color: var(--text-faint);
font-size: 0.85rem;
}
footer a {
color: var(--text-muted);
}
/* Responsive */
@media (max-width: 640px) {
.app {
padding: 1.25rem 0.75rem 2rem;
}
.search-form {
flex-direction: column;
}
.search-form button[type="submit"] {
width: 100%;
}
table {
font-size: 0.8rem;
}
thead th,
tbody td {
padding: 0.45rem 0.4rem;
}
.preset-list {
flex-direction: column;
align-items: stretch;
}
.preset-btn {
text-align: left;
}
}