/* Dialog & Toast System */
/* Overlay */
.dialog-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: var(--color-overlay);
z-index: 1000;
display: flex;
align-items: center;
justify-content: center;
opacity: 0;
visibility: hidden;
transition: all var(--transition-fast);
backdrop-filter: blur(2px);
}
.dialog-overlay--visible {
opacity: 1;
visibility: visible;
}
/* Dialog Box */
.dialog {
background-color: var(--color-bg-surface);
border-radius: var(--radius-lg);
box-shadow: 0 10px 25px -5px var(--color-shadow), 0 8px 10px -6px var(--color-shadow);
width: 90%;
max-width: 400px;
transform: scale(0.95);
opacity: 0;
transition: all var(--transition-normal);
display: flex;
flex-direction: column;
overflow: hidden;
border: 1px solid var(--color-border);
}
.dialog-overlay--visible .dialog {
transform: scale(1);
opacity: 1;
}
/* Header */
.dialog__header {
padding: var(--spacing-md) var(--spacing-lg);
border-bottom: 1px solid var(--color-border);
font-weight: 600;
font-size: 1.125rem;
color: var(--color-text-main);
display: flex;
align-items: center;
justify-content: space-between;
}
.dialog__close {
cursor: pointer;
color: var(--color-text-muted);
transition: color var(--transition-fast);
background: none;
border: none;
font-size: 1.25rem;
padding: 0;
line-height: 1;
}
.dialog__close:hover {
color: var(--color-text-main);
}
/* Body */
.dialog__body {
padding: var(--spacing-lg);
color: var(--color-text-secondary);
font-size: 1rem;
line-height: 1.6;
}
.dialog__input-wrapper {
margin-top: var(--spacing-md);
}
.dialog__input {
width: 100%;
padding: 0.5rem 0.75rem;
border: 1px solid var(--color-border);
border-radius: var(--radius-sm);
background-color: var(--color-bg-body);
color: var(--color-text-main);
font-size: 1rem;
transition: border-color var(--transition-fast);
}
.dialog__input:focus {
outline: none;
border-color: var(--color-primary);
box-shadow: 0 0 0 2px rgba(var(--color-primary-rgb), 0.1);
}
/* Footer */
.dialog__footer {
padding: var(--spacing-md) var(--spacing-lg);
border-top: 1px solid var(--color-border);
display: flex;
justify-content: flex-end;
gap: var(--spacing-sm);
background-color: var(--color-bg-surface-alt);
}
/* Buttons */
.dialog__btn {
padding: 0.5rem 1rem;
border-radius: var(--radius-sm);
font-size: 0.875rem;
font-weight: 500;
cursor: pointer;
transition: all var(--transition-fast);
border: 1px solid transparent;
}
.dialog__btn--primary {
background-color: var(--color-primary);
color: #ffffff;
}
.dialog__btn--primary:hover {
background-color: var(--color-primary-hover);
}
.dialog__btn--default {
background-color: var(--color-bg-surface);
border-color: var(--color-border);
color: var(--color-text-secondary);
}
.dialog__btn--default:hover {
background-color: var(--color-bg-body);
color: var(--color-text-main);
}
/* Toast (Non-modal) */
.toast-container {
position: fixed;
z-index: 2000;
display: flex;
flex-direction: column;
gap: 10px;
pointer-events: none; /* Allow clicking through container */
}
/* Toast 位置变体 */
.toast-container--top-center {
top: 20px;
left: 50%;
transform: translateX(-50%);
}
.toast-container--top-left {
top: 20px;
left: 20px;
}
.toast-container--top-right {
top: 20px;
right: 20px;
}
.toast-container--bottom-center {
bottom: 20px;
left: 50%;
transform: translateX(-50%);
}
.toast-container--bottom-left {
bottom: 20px;
left: 20px;
}
.toast-container--bottom-right {
bottom: 20px;
right: 20px;
}
/* 底部位置的 toast 动画方向调整 */
.toast-container--bottom-center .toast,
.toast-container--bottom-left .toast,
.toast-container--bottom-right .toast {
animation: toast-enter-bottom 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.toast-container--bottom-center .toast.is-leaving,
.toast-container--bottom-left .toast.is-leaving,
.toast-container--bottom-right .toast.is-leaving {
animation: toast-exit-bottom 0.4s cubic-bezier(0.36, 0, 0.66, -0.56) forwards;
}
/* 左右位置的 toast 动画方向调整 */
.toast-container--top-left .toast,
.toast-container--bottom-left .toast {
animation: toast-enter-left 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.toast-container--top-left .toast.is-leaving,
.toast-container--bottom-left .toast.is-leaving {
animation: toast-exit-left 0.4s cubic-bezier(0.36, 0, 0.66, -0.56) forwards;
}
.toast-container--top-right .toast,
.toast-container--bottom-right .toast {
animation: toast-enter-right 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.toast-container--top-right .toast.is-leaving,
.toast-container--bottom-right .toast.is-leaving {
animation: toast-exit-right 0.4s cubic-bezier(0.36, 0, 0.66, -0.56) forwards;
}
.toast {
background: var(--color-bg-surface);
color: var(--color-text-main);
padding: 1rem 1.25rem;
border-radius: 12px;
box-shadow:
0 8px 16px -4px rgba(0, 0, 0, 0.1),
0 4px 8px -2px rgba(0, 0, 0, 0.06),
0 0 0 1px var(--color-border);
display: flex;
align-items: center;
gap: 0.875rem;
min-width: 200px;
max-width: 90vw;
animation: toast-enter 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
pointer-events: auto;
backdrop-filter: blur(12px) saturate(180%);
-webkit-backdrop-filter: blur(12px) saturate(180%);
position: relative;
transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
cursor: default;
}
.toast:hover {
transform: translateY(-2px);
box-shadow:
0 12px 24px -6px rgba(0, 0, 0, 0.15),
0 6px 12px -3px rgba(0, 0, 0, 0.08),
0 0 0 1px var(--color-border);
opacity: 1;
}
/* 不同类型的 toast 背景渐变 */
.toast--info {
background: linear-gradient(135deg,
rgba(var(--color-primary-rgb), 0.08) 0%,
var(--color-bg-surface) 100%);
}
.toast--success {
background: linear-gradient(135deg,
rgba(34, 197, 94, 0.08) 0%,
var(--color-bg-surface) 100%);
}
.toast--warning {
background: linear-gradient(135deg,
rgba(245, 158, 11, 0.08) 0%,
var(--color-bg-surface) 100%);
}
.toast--error {
background: linear-gradient(135deg,
rgba(239, 68, 68, 0.08) 0%,
var(--color-bg-surface) 100%);
}
/* 图标容器 - 使用圆形背景 */
.toast__icon {
font-size: 1.25rem;
width: 36px;
height: 36px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
position: relative;
}
.toast:hover .toast__icon {
transform: scale(1.15) rotate(8deg);
}
.toast--success .toast__icon {
background: rgba(34, 197, 94, 0.18);
color: var(--color-status-success);
box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.08);
}
.toast--warning .toast__icon {
background: rgba(245, 158, 11, 0.18);
color: var(--color-status-warning);
box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.08);
}
.toast--error .toast__icon {
background: rgba(239, 68, 68, 0.18);
color: var(--color-status-error);
box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08);
}
.toast--info .toast__icon {
background: rgba(var(--color-primary-rgb), 0.18);
color: var(--color-primary);
box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.08);
}
/* Toast 内容样式 */
.toast__content {
flex: 1;
font-size: 0.9375rem;
line-height: 1.5;
font-weight: 500;
}
.toast.is-leaving {
animation: toast-exit 0.4s cubic-bezier(0.36, 0, 0.66, -0.56) forwards;
}
@keyframes toast-enter {
from {
opacity: 0;
transform: translateY(-20px) scale(0.95);
}
to {
opacity: 1;
transform: translateY(0) scale(1);
}
}
@keyframes toast-exit {
from {
opacity: 1;
transform: translateY(0) scale(1);
}
to {
opacity: 0;
transform: translateY(-20px) scale(0.95);
}
}
/* 底部入场/退场动画 */
@keyframes toast-enter-bottom {
from {
opacity: 0;
transform: translateY(20px) scale(0.95);
}
to {
opacity: 1;
transform: translateY(0) scale(1);
}
}
@keyframes toast-exit-bottom {
from {
opacity: 1;
transform: translateY(0) scale(1);
}
to {
opacity: 0;
transform: translateY(20px) scale(0.95);
}
}
/* 左侧入场/退场动画 */
@keyframes toast-enter-left {
from {
opacity: 0;
transform: translateX(-20px) scale(0.95);
}
to {
opacity: 1;
transform: translateX(0) scale(1);
}
}
@keyframes toast-exit-left {
from {
opacity: 1;
transform: translateX(0) scale(1);
}
to {
opacity: 0;
transform: translateX(-20px) scale(0.95);
}
}
/* 右侧入场/退场动画 */
@keyframes toast-enter-right {
from {
opacity: 0;
transform: translateX(20px) scale(0.95);
}
to {
opacity: 1;
transform: translateX(0) scale(1);
}
}
@keyframes toast-exit-right {
from {
opacity: 1;
transform: translateX(0) scale(1);
}
to {
opacity: 0;
transform: translateX(20px) scale(0.95);
}
}
/* Tooltip */
.dialog-tooltip {
position: fixed;
z-index: 10000;
padding: 6px 10px;
background: var(--color-tooltip-bg);
color: var(--color-tooltip-text);
border-radius: 4px;
font-size: 13px;
line-height: 1.4;
pointer-events: none;
opacity: 0;
transition: opacity 0.2s ease, transform 0.2s ease;
max-width: 300px;
word-wrap: break-word;
border: 1px solid var(--color-tooltip-border);
box-shadow: 0 4px 12px var(--color-shadow);
backdrop-filter: blur(4px);
transform: translateY(5px); /* Animation start pos */
}
.dialog-tooltip.is-visible {
opacity: 1;
transform: translateY(0);
}
/* Tooltip Arrow */
.dialog-tooltip::after {
content: '';
position: absolute;
width: 0;
height: 0;
border-style: solid;
left: 50%;
transform: translateX(-50%);
}
/* Arrow for Top (default) position */
.dialog-tooltip:not(.is-bottom)::after {
bottom: -6px;
border-width: 6px 6px 0 6px;
border-color: var(--color-tooltip-bg) transparent transparent transparent;
}
/* Arrow for Bottom position */
.dialog-tooltip.is-bottom::after {
top: -6px;
border-width: 0 6px 6px 6px;
border-color: transparent transparent var(--color-tooltip-bg) transparent;
}
/* Mobile Adaptation */
@media (max-width: 640px) {
.dialog {
width: 95%;
margin: 0 auto;
}
/* 移动端所有 toast 容器统一显示在底部 */
.toast-container {
width: 100%;
padding: 0 1rem;
top: auto !important;
bottom: 1.5rem !important;
left: 0 !important;
right: auto !important;
transform: none !important;
}
.toast {
width: 100%;
padding: 0.875rem 1rem;
border-radius: 10px;
animation: toast-enter-mobile 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards !important;
}
.toast__icon {
width: 32px;
height: 32px;
font-size: 1.125rem;
}
.toast__content {
font-size: 0.875rem;
}
/* 移动端保持轻微的交互反馈 */
.toast:active {
transform: scale(0.98);
}
.toast:hover {
transform: translateY(0);
}
.toast:hover .toast__icon {
transform: none; /* 移动端禁用图标悬停动画 */
}
.toast.is-leaving {
animation: toast-exit-mobile 0.4s cubic-bezier(0.36, 0, 0.66, -0.56) forwards !important;
}
@keyframes toast-enter-mobile {
from {
opacity: 0;
transform: translateY(20px) scale(0.95);
}
to {
opacity: 1;
transform: translateY(0) scale(1);
}
}
@keyframes toast-exit-mobile {
from {
opacity: 1;
transform: translateY(0) scale(1);
}
to {
opacity: 0;
transform: translateY(20px) scale(0.95);
}
}
to { opacity: 0; transform: translateY(20px); }
}
}
/* ========== 通知框样式 ========== */
/* 通知框容器 */
.notification-box {
position: fixed;
right: 20px;
top: 15px;
width: 350px;
background-color: var(--color-bg-surface);
border-radius: var(--radius-md);
box-shadow: 0 4px 6px -1px var(--color-shadow), 0 2px 4px -1px var(--color-shadow);
border: 1px solid var(--color-border);
z-index: 1500;
opacity: 0;
transform: translateX(100%);
transition: opacity var(--transition-normal), transform var(--transition-normal);
overflow: hidden;
box-sizing: border-box;
}
.notification-box--enter {
opacity: 1;
transform: translateX(0);
}
.notification-box--exit {
opacity: 0;
transform: translateX(100%);
}
/* 通知框类型修饰符 */
.notification-box--info {
border-left: 4px solid var(--color-primary);
}
.notification-box--success {
border-left: 4px solid var(--color-status-success);
}
.notification-box--warning {
border-left: 4px solid var(--color-status-warning);
}
.notification-box--error {
border-left: 4px solid var(--color-status-error);
}
/* 通知框标题 */
.notification-box__title {
padding: var(--spacing-md) var(--spacing-lg);
font-weight: 600;
font-size: 1rem;
color: var(--color-text-main);
border-bottom: 1px solid var(--color-border);
}
/* 通知框内容容器 */
.notification-box__content-container {
padding: var(--spacing-md) var(--spacing-lg);
}
/* 通知框内容 */
.notification-box__content {
color: var(--color-text-secondary);
font-size: 0.875rem;
line-height: 1.6;
word-wrap: break-word;
}
/* 通知框进度条容器 */
.notification-box__progress {
margin-top: var(--spacing-sm);
height: 26px;
background-color: var(--color-bg-surface-alt);
border-radius: var(--radius-md);
overflow: hidden;
position: relative;
display: flex;
align-items: center;
gap: 8px;
}
/* 通知框进度条背景 */
.notification-box__progress-track {
flex: 1;
height: 100%;
background-color: var(--color-bg-surface-alt);
border-radius: var(--radius-md);
overflow: hidden;
position: relative;
}
/* 通知框进度条 */
.notification-box__progress-bar {
height: 100%;
background-color: var(--color-primary);
border-radius: var(--radius-md);
transition: width var(--transition-normal);
position: absolute;
top: 0;
left: 0;
min-width: 0;
width: 0;
}
/* 当进度为0时完全隐藏 */
.notification-box__progress-bar[style*="width: 0%"],
.notification-box__progress-bar[style*="width:0%"] {
display: none;
}
.notification-box--success .notification-box__progress-bar {
background-color: var(--color-status-success);
}
.notification-box--warning .notification-box__progress-bar {
background-color: var(--color-status-warning);
}
.notification-box--error .notification-box__progress-bar {
background-color: var(--color-status-error);
}
/* 通知框进度条文本(固定在进度条轨道中间) */
.notification-box__progress-text {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
font-size: 0.8125rem;
font-weight: 600;
white-space: nowrap;
line-height: 1;
letter-spacing: 0.02em;
z-index: 1;
pointer-events: none;
color: var(--color-tooltip-text);
text-shadow: 0 1px 3px var(--color-shadow);
}
/* 当进度条为0或隐藏时,文字颜色改为深色以便在浅色背景上可见 */
.notification-box__progress-bar[style*="display: none"] ~ .notification-box__progress-text,
.notification-box__progress-bar[style*="display:none"] ~ .notification-box__progress-text {
color: var(--color-text-secondary);
text-shadow: none;
}
/* 通知框进度条文本(外部,当进度太小时显示在右侧) */
.notification-box__progress-text--external {
font-size: 0.8125rem;
color: var(--color-text-secondary);
font-weight: 600;
white-space: nowrap;
line-height: 1;
letter-spacing: 0.02em;
min-width: 50px;
text-align: right;
flex-shrink: 0;
}
/* 通知框关闭按钮 */
.notification-box__close {
position: absolute;
top: var(--spacing-sm);
right: var(--spacing-sm);
width: 24px;
height: 24px;
display: flex;
align-items: center;
justify-content: center;
background: none;
border: none;
cursor: pointer;
color: var(--color-text-muted);
font-size: 1.25rem;
line-height: 1;
padding: 0;
border-radius: var(--radius-sm);
transition: all var(--transition-fast);
}
.notification-box__close:hover {
color: var(--color-text-main);
background-color: var(--color-bg-surface-alt);
}
.notification-box__close:focus {
outline: 2px solid var(--color-primary);
outline-offset: 2px;
}
/* 深色模式适配 */
@media (prefers-color-scheme: dark) {
.toast {
box-shadow:
0 8px 16px -4px rgba(0, 0, 0, 0.3),
0 4px 8px -2px rgba(0, 0, 0, 0.2),
0 0 0 1px rgba(255, 255, 255, 0.05);
}
.toast:hover {
box-shadow:
0 12px 24px -6px rgba(0, 0, 0, 0.4),
0 6px 12px -3px rgba(0, 0, 0, 0.25),
0 0 0 1px rgba(255, 255, 255, 0.08);
}
/* 深色模式下增强背景对比度 */
.toast--info {
background: linear-gradient(135deg,
rgba(var(--color-primary-rgb), 0.12) 0%,
var(--color-bg-surface) 100%);
}
.toast--success {
background: linear-gradient(135deg,
rgba(34, 197, 94, 0.12) 0%,
var(--color-bg-surface) 100%);
}
.toast--warning {
background: linear-gradient(135deg,
rgba(245, 158, 11, 0.12) 0%,
var(--color-bg-surface) 100%);
}
.toast--error {
background: linear-gradient(135deg,
rgba(239, 68, 68, 0.12) 0%,
var(--color-bg-surface) 100%);
}
/* 深色模式下图标背景更明显 */
.toast--success .toast__icon {
background: rgba(34, 197, 94, 0.22);
box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.12);
}
.toast--warning .toast__icon {
background: rgba(245, 158, 11, 0.22);
box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.12);
}
.toast--error .toast__icon {
background: rgba(239, 68, 68, 0.22);
box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}
.toast--info .toast__icon {
background: rgba(var(--color-primary-rgb), 0.22);
box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.12);
}
}
/* 移动端适配 */
@media (max-width: 640px) {
.notification-box {
right: 10px;
left: 10px;
width: calc(100% - 20px);
max-width: none;
}
} 评论加载中...