refactor(css): maximize usage of variables (1st part, to simplify CSS & style)

note: there is still work to do, but has there are risks to conflict I prefer to commit this first part now
This commit is contained in:
Edouard Vanbelle
2026-04-08 11:03:20 +02:00
parent 904aca5edf
commit 94b36e41e0
35 changed files with 2957 additions and 2535 deletions
+61 -158
View File
@@ -3,18 +3,18 @@
position: absolute;
top: 70px;
right: 20px;
background-color: white;
background-color: var(--color-notification-bg);
width: 250px;
border-radius: 8px;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
box-shadow: 0 5px 15px var(--color-shadow);
padding: 15px;
border-left: 4px solid #ff5e3a;
border-left: 4px solid var(--color-accent);
z-index: 1000;
display: none;
[dir="rtl"] & {
left: 20px;
border-right: 4px solid #ff5e3a;
border-right: 4px solid var(--color-accent);
right: unset;
border-left: unset;
}
@@ -24,12 +24,12 @@
font-weight: bold;
font-size: 14px;
margin-bottom: 5px;
color: #2d3748;
color: var(--color-text);
}
.notification-message {
font-size: 12px;
color: #718096;
color: var(--color-text-muted);
}
/* Notification banner */
@@ -38,9 +38,9 @@
top: 20px;
right: 20px;
padding: 15px 20px;
background-color: white;
background-color: var(--color-notification-bg);
border-radius: 8px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
box-shadow: 0 4px 12px var(--color-shadow);
display: flex;
align-items: center;
justify-content: space-between;
@@ -59,11 +59,11 @@
}
.notification-banner.success {
border-left: 4px solid #48bb78;
border-left: 4px solid var(--color-success-border);
}
.notification-banner.error {
border-left: 4px solid #f56565;
border-left: 4px solid var(--color-danger-bg);
}
.close-notification-btn {
@@ -71,7 +71,7 @@
border: none;
font-size: 18px;
cursor: pointer;
color: #a0aec0;
color: var(--color-text-placeholder);
margin-left: 10px;
}
@@ -85,7 +85,7 @@
border: none;
cursor: pointer;
font-size: 18px;
color: #64748b;
color: var(--color-text-subtle);
width: 40px;
height: 40px;
border-radius: 50%;
@@ -97,13 +97,13 @@
}
.notif-bell-btn:hover {
background: rgba(255, 94, 58, 0.08);
color: #ff5e3a;
background: var(--color-accent-bg-sm);
color: var(--color-accent);
}
.notif-bell-btn.active {
color: #ff5e3a;
background: rgba(255, 94, 58, 0.1);
color: var(--color-accent);
background: var(--color-accent-ring);
}
.notif-badge {
@@ -114,8 +114,8 @@
height: 16px;
line-height: 16px;
border-radius: 8px;
background: #ff3b30;
color: #fff;
background: var(--color-notification-badge);
color: var(--color-notification-bg);
font-size: 10px;
font-weight: 700;
text-align: center;
@@ -162,11 +162,11 @@
right: -40px;
width: 380px;
max-height: 480px;
background: #fff;
background: var(--color-notification-bg);
border-radius: 16px;
box-shadow:
0 12px 40px rgba(0, 0, 0, 0.15),
0 0 0 1px rgba(0, 0, 0, 0.05);
0 12px 40px var(--color-shadow-md),
0 0 0 1px var(--color-shadow-xs);
z-index: 2000;
overflow: hidden;
animation: notifPanelIn 0.2s ease-out;
@@ -193,20 +193,20 @@
align-items: center;
justify-content: space-between;
padding: 14px 16px;
border-bottom: 1px solid #f0f0f0;
border-bottom: 1px solid var(--color-border-xfaint);
}
.notif-panel-title {
font-weight: 600;
font-size: 15px;
color: #1e293b;
color: var(--color-text-heading);
}
.notif-clear-btn {
background: none;
border: none;
cursor: pointer;
color: #94a3b8;
color: var(--color-text-faint);
font-size: 14px;
padding: 4px 8px;
border-radius: 6px;
@@ -214,8 +214,8 @@
}
.notif-clear-btn:hover {
color: #ff5e3a;
background: rgba(255, 94, 58, 0.08);
color: var(--color-accent);
background: var(--color-accent-bg-sm);
}
.notif-panel-body {
@@ -230,7 +230,7 @@
align-items: center;
justify-content: center;
padding: 40px 20px;
color: #94a3b8;
color: var(--color-text-faint);
gap: 8px;
}
@@ -248,7 +248,7 @@
align-items: flex-start;
padding: 12px 16px;
gap: 12px;
border-bottom: 1px solid #f5f5f5;
border-bottom: 1px solid var(--color-bg-subtle);
transition: background 0.15s;
cursor: default;
}
@@ -258,7 +258,7 @@
}
.notif-item:hover {
background: #f8fafc;
background: var(--color-bg-hover);
}
.notif-item-icon {
@@ -273,18 +273,18 @@
}
.notif-item-icon.upload {
background: rgba(255, 94, 58, 0.1);
color: #ff5e3a;
background: var(--color-accent-ring);
color: var(--color-accent);
}
.notif-item-icon.success {
background: rgba(52, 199, 89, 0.1);
color: #34c759;
background: var(--color-success-ring);
color: var(--color-notification-success);
}
.notif-item-icon.error {
background: rgba(255, 59, 48, 0.1);
color: #ff3b30;
background: var(--color-notification-error-ring);
color: var(--color-notification-error);
}
.notif-item-body {
@@ -295,13 +295,13 @@
.notif-item-title {
font-size: 13px;
font-weight: 600;
color: #1e293b;
color: var(--color-text-heading);
margin-bottom: 2px;
}
.notif-item-text {
font-size: 12px;
color: #64748b;
color: var(--color-text-subtle);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
@@ -309,7 +309,7 @@
.notif-item-time {
font-size: 11px;
color: #94a3b8;
color: var(--color-text-faint);
margin-top: 3px;
}
@@ -319,25 +319,25 @@
.notif-upload-bar {
height: 3px;
background: #eee;
background: var(--color-bg-empty);
border-radius: 2px;
overflow: hidden;
}
.notif-upload-fill {
height: 100%;
background: #ff5e3a;
background: var(--color-accent);
width: 0%;
transition: width 0.2s ease;
border-radius: 2px;
}
.notif-upload-fill.done {
background: #34c759;
background: var(--color-notification-success);
}
.notif-upload-fill.error {
background: #ff3b30;
background: var(--color-notification-error);
}
.notif-upload-detail {
@@ -350,7 +350,7 @@
.notif-upload-pct,
.notif-upload-stats {
font-size: 11px;
color: #94a3b8;
color: var(--color-text-faint);
}
/* Upload Progress Toast (legacy — hidden, kept for compat) */
@@ -360,9 +360,9 @@
right: 24px;
width: 360px;
max-height: 400px;
background: #fff;
background: var(--color-notification-bg);
border-radius: 12px;
box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
box-shadow: 0 8px 30px var(--color-shadow-md);
z-index: 10000;
display: none;
flex-direction: column;
@@ -391,8 +391,8 @@
align-items: center;
justify-content: space-between;
padding: 12px 16px;
background: #ff5e3a;
color: #fff;
background: var(--color-accent);
color: var(--color-danger-text);
}
.upload-toast-title {
@@ -403,7 +403,7 @@
.upload-toast-close {
background: none;
border: none;
color: #fff;
color: var(--color-danger-text);
font-size: 20px;
cursor: pointer;
line-height: 1;
@@ -431,18 +431,18 @@
.upload-toast-file-icon {
font-size: 16px;
color: #999;
color: var(--color-text-light);
flex-shrink: 0;
width: 20px;
text-align: center;
}
.upload-toast-file-icon.done {
color: #34c759;
color: var(--color-notification-success);
}
.upload-toast-file-icon.error {
color: #ff3b30;
color: var(--color-notification-error);
}
.upload-toast-file-info {
@@ -452,7 +452,7 @@
.upload-toast-file-name {
font-size: 13px;
color: #333;
color: var(--color-text-black);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
@@ -460,7 +460,7 @@
.upload-toast-file-bar {
height: 3px;
background: #eee;
background: var(--color-bg-empty);
border-radius: 2px;
margin-top: 4px;
overflow: hidden;
@@ -468,23 +468,23 @@
.upload-toast-file-fill {
height: 100%;
background: #ff5e3a;
background: var(--color-accent);
width: 0%;
transition: width 0.2s ease;
border-radius: 2px;
}
.upload-toast-file-fill.done {
background: #34c759;
background: var(--color-notification-success);
}
.upload-toast-file-fill.error {
background: #ff3b30;
background: var(--color-notification-error);
}
.upload-toast-file-pct {
font-size: 12px;
color: #999;
color: var(--color-text-light);
flex-shrink: 0;
width: 38px;
text-align: right;
@@ -492,12 +492,12 @@
.upload-toast-footer {
padding: 10px 16px;
border-top: 1px solid #f0f0f0;
border-top: 1px solid var(--color-border-xfaint);
}
.upload-toast-overall-bar {
height: 4px;
background: #eee;
background: var(--color-bg-empty);
border-radius: 2px;
overflow: hidden;
margin-bottom: 6px;
@@ -505,7 +505,7 @@
.upload-toast-overall-fill {
height: 100%;
background: #ff5e3a;
background: var(--color-accent);
width: 0%;
transition: width 0.25s ease;
border-radius: 2px;
@@ -513,102 +513,5 @@
.upload-toast-stats {
font-size: 12px;
color: #888;
}
[data-theme="dark"] .notification {
background-color: #1e293b;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
[data-theme="dark"] .notification-title {
color: #f1f5f9;
}
[data-theme="dark"] .notification-message {
color: #94a3b8;
}
[data-theme="dark"] .notification-banner {
background-color: #1e293b;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
[data-theme="dark"] .notif-bell-btn {
color: #94a3b8;
}
[data-theme="dark"] .notif-bell-btn:hover,
[data-theme="dark"] .notif-bell-btn.active {
color: #ff5e3a;
background: rgba(255, 94, 58, 0.15);
}
[data-theme="dark"] .notif-panel {
background: #1e293b;
box-shadow:
0 12px 40px rgba(0, 0, 0, 0.4),
0 0 0 1px rgba(255, 255, 255, 0.06);
}
[data-theme="dark"] .notif-panel-header {
border-bottom-color: #334155;
}
[data-theme="dark"] .notif-panel-title {
color: #f1f5f9;
}
[data-theme="dark"] .notif-clear-btn {
color: #64748b;
}
[data-theme="dark"] .notif-clear-btn:hover {
color: #ff5e3a;
background: rgba(255, 94, 58, 0.12);
}
[data-theme="dark"] .notif-empty {
color: #64748b;
}
[data-theme="dark"] .notif-item {
border-bottom-color: #1a2536;
}
[data-theme="dark"] .notif-item:hover {
background: #162032;
}
[data-theme="dark"] .notif-item-title {
color: #e2e8f0;
}
[data-theme="dark"] .notif-item-text {
color: #94a3b8;
}
[data-theme="dark"] .notif-upload-bar {
background: #334155;
}
[data-theme="dark"] .upload-toast {
background: #1e293b;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}
[data-theme="dark"] .upload-toast-file-name {
color: #e2e8f0;
}
[data-theme="dark"] .upload-toast-file-bar {
background: #334155;
}
[data-theme="dark"] .upload-toast-file-pct {
color: #64748b;
}
[data-theme="dark"] .upload-toast-footer {
border-top-color: #334155;
color: var(--color-text-faint2);
}