Files
happy-life-star/web/src/styles/global.scss
T

270 lines
4.9 KiB
SCSS

// 全局样式变量
:root {
// 主题色彩
--primary-color: #667eea;
--primary-light: #8fa4f3;
--primary-dark: #4c63d2;
--secondary-color: #764ba2;
--accent-color: #f093fb;
// 渐变色
--gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
--gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
--gradient-success: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
--gradient-warning: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
// 文字颜色
--text-primary: #2c3e50;
--text-secondary: #7f8c8d;
--text-light: #bdc3c7;
--text-white: #ffffff;
// 背景色
--bg-primary: #ffffff;
--bg-secondary: #f8f9fa;
--bg-dark: #2c3e50;
--bg-overlay: rgba(0, 0, 0, 0.5);
// 边框和阴影
--border-color: #e9ecef;
--border-radius: 12px;
--border-radius-small: 8px;
--border-radius-large: 16px;
--box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
--box-shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.15);
// 间距
--spacing-xs: 4px;
--spacing-sm: 8px;
--spacing-md: 16px;
--spacing-lg: 24px;
--spacing-xl: 32px;
--spacing-xxl: 48px;
}
// 重置样式
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html, body {
height: 100%;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
// 通用工具类
.flex {
display: flex;
}
.flex-center {
display: flex;
align-items: center;
justify-content: center;
}
.flex-between {
display: flex;
align-items: center;
justify-content: space-between;
}
.flex-column {
display: flex;
flex-direction: column;
}
.text-center {
text-align: center;
}
.text-left {
text-align: left;
}
.text-right {
text-align: right;
}
.w-full {
width: 100%;
}
.h-full {
height: 100%;
}
.overflow-hidden {
overflow: hidden;
}
.overflow-auto {
overflow: auto;
}
// 渐变文字
.gradient-text {
background: var(--gradient-primary);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
font-weight: 600;
}
// 玻璃态效果
.glass {
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.2);
border-radius: var(--border-radius);
}
// 卡片样式
.card {
background: var(--bg-primary);
border-radius: var(--border-radius);
box-shadow: var(--box-shadow);
padding: var(--spacing-lg);
transition: all 0.3s ease;
&:hover {
box-shadow: var(--box-shadow-hover);
transform: translateY(-2px);
}
}
// 按钮样式增强
.ant-btn {
border-radius: var(--border-radius-small);
font-weight: 500;
transition: all 0.3s ease;
&.gradient-btn {
background: var(--gradient-primary);
border: none;
color: white;
&:hover {
background: var(--gradient-primary);
opacity: 0.9;
transform: translateY(-1px);
box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}
}
}
// 输入框样式增强
.ant-input {
border-radius: var(--border-radius-small);
border: 1px solid var(--border-color);
transition: all 0.3s ease;
&:focus {
border-color: var(--primary-color);
box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}
}
// 消息气泡样式
.message-bubble {
max-width: 70%;
padding: var(--spacing-md);
border-radius: var(--border-radius);
margin-bottom: var(--spacing-md);
word-wrap: break-word;
&.user {
background: var(--gradient-primary);
color: white;
margin-left: auto;
border-bottom-right-radius: var(--spacing-xs);
}
&.assistant {
background: var(--bg-primary);
color: var(--text-primary);
border: 1px solid var(--border-color);
border-bottom-left-radius: var(--spacing-xs);
}
}
// 响应式设计
@media (max-width: 768px) {
.message-bubble {
max-width: 85%;
}
.card {
padding: var(--spacing-md);
}
}
// 动画类
.bounce-in {
animation: bounceIn 0.6s ease;
}
@keyframes bounceIn {
0% {
opacity: 0;
transform: scale(0.3);
}
50% {
opacity: 1;
transform: scale(1.05);
}
70% {
transform: scale(0.9);
}
100% {
opacity: 1;
transform: scale(1);
}
}
.fade-in-up {
animation: fadeInUp 0.6s ease;
}
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(30px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
// 加载动画
.loading-dots {
display: inline-block;
&::after {
content: '';
animation: dots 1.5s steps(5, end) infinite;
}
}
@keyframes dots {
0%, 20% {
color: rgba(0, 0, 0, 0);
text-shadow: 0.25em 0 0 rgba(0, 0, 0, 0), 0.5em 0 0 rgba(0, 0, 0, 0);
}
40% {
color: black;
text-shadow: 0.25em 0 0 rgba(0, 0, 0, 0), 0.5em 0 0 rgba(0, 0, 0, 0);
}
60% {
text-shadow: 0.25em 0 0 black, 0.5em 0 0 rgba(0, 0, 0, 0);
}
80%, 100% {
text-shadow: 0.25em 0 0 black, 0.5em 0 0 black;
}
}