Book_system/app/static/css/user-form.css
superlishunqin 29914a4178 0506
2025-05-06 12:01:11 +08:00

637 lines
13 KiB
CSS

/* 用户表单样式 - 甜美风格 */
.user-form-container {
max-width: 850px;
margin: 25px auto;
padding: 0 20px;
}
.page-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 25px;
padding-bottom: 15px;
border-bottom: 2px solid #f8e6e8;
animation: slideInDown 0.6s ease-out;
}
.page-header h1 {
margin: 0;
font-size: 28px;
color: #e75480; /* 粉红色调 */
font-weight: 600;
letter-spacing: 0.5px;
}
.form-card {
background-color: #fff;
border-radius: 12px;
box-shadow: 0 5px 20px rgba(231, 84, 128, 0.08);
padding: 30px;
border: 1px solid #f8e6e8;
position: relative;
overflow: visible;
animation: fadeIn 0.7s ease-out;
}
.form-group {
margin-bottom: 22px;
animation: slideInRight 0.4s ease-out;
animation-fill-mode: both;
}
/* 为每个表单组添加延迟,创造波浪效果 */
.form-group:nth-child(1) { animation-delay: 0.1s; }
.form-group:nth-child(2) { animation-delay: 0.2s; }
.form-group:nth-child(3) { animation-delay: 0.3s; }
.form-group:nth-child(4) { animation-delay: 0.4s; }
.form-group:nth-child(5) { animation-delay: 0.5s; }
.form-group:nth-child(6) { animation-delay: 0.6s; }
.form-group:nth-child(7) { animation-delay: 0.7s; }
.form-group:nth-child(8) { animation-delay: 0.8s; }
.form-group:nth-child(9) { animation-delay: 0.9s; }
.form-group:nth-child(10) { animation-delay: 1.0s; }
.form-group.required label:after {
content: " *";
color: #ff6b8b;
}
.form-group label {
display: block;
margin-bottom: 8px;
font-weight: 500;
color: #5d5d5d;
font-size: 15px;
transition: all 0.3s ease;
}
.form-group:hover label {
color: #e75480;
transform: translateX(3px);
}
.form-control {
display: block;
width: 100%;
padding: 12px 15px;
font-size: 15px;
line-height: 1.5;
color: #555;
background-color: #fff;
background-clip: padding-box;
border: 1.5px solid #ffd1dc; /* 淡粉色边框 */
border-radius: 8px;
transition: all 0.3s ease;
}
.form-control:focus {
border-color: #ff8da1;
outline: 0;
box-shadow: 0 0 0 3px rgba(255, 141, 161, 0.25);
transform: translateY(-2px);
}
.form-control::placeholder {
color: #bbb;
font-style: italic;
}
.password-field {
position: relative;
}
.toggle-password {
position: absolute;
right: 12px;
top: 50%;
transform: translateY(-50%);
background: none;
border: none;
cursor: pointer;
color: #ff8da1;
transition: all 0.3s ease;
z-index: 2;
}
.toggle-password:hover {
color: #e75480;
transform: translateY(-50%) scale(1.2);
}
.input-with-button {
display: flex;
gap: 12px;
}
.input-with-button .form-control {
flex: 1;
}
.input-with-button .btn {
white-space: nowrap;
}
.form-text {
display: block;
margin-top: 6px;
font-size: 13.5px;
color: #888;
font-style: italic;
transition: all 0.3s ease;
}
.form-text.text-danger {
color: #ff5c77;
font-style: normal;
animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}
.form-text.text-success {
color: #7ac98f;
font-style: normal;
animation: pulse 0.5s ease;
}
.form-actions {
display: flex;
gap: 15px;
margin-top: 35px;
justify-content: center;
animation: fadeInUp 0.8s ease-out;
animation-delay: 1.2s;
animation-fill-mode: both;
}
.btn {
display: inline-block;
font-weight: 500;
text-align: center;
white-space: nowrap;
vertical-align: middle;
user-select: none;
border: 1.5px solid transparent;
padding: 10px 22px;
font-size: 15px;
line-height: 1.5;
border-radius: 25px; /* 圆润按钮 */
transition: all 0.3s ease;
cursor: pointer;
letter-spacing: 0.3px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
position: relative;
overflow: hidden;
}
/* 按钮波纹效果 */
.btn:after {
content: "";
position: absolute;
top: 50%;
left: 50%;
width: 5px;
height: 5px;
background: rgba(255, 255, 255, 0.5);
opacity: 0;
border-radius: 100%;
transform: scale(1, 1) translate(-50%);
transform-origin: 50% 50%;
}
.btn:focus:not(:active)::after {
animation: ripple 1s ease-out;
}
@keyframes ripple {
0% {
transform: scale(0, 0);
opacity: 0.5;
}
20% {
transform: scale(25, 25);
opacity: 0.3;
}
100% {
transform: scale(50, 50);
opacity: 0;
}
}
.btn-primary {
color: #fff;
background-color: #ff8da1;
border-color: #ff8da1;
}
.btn-primary:hover {
color: #fff;
background-color: #ff7389;
border-color: #ff7389;
box-shadow: 0 4px 8px rgba(255, 141, 161, 0.3);
transform: translateY(-3px);
}
.btn-primary:active {
transform: translateY(-1px);
}
.btn-secondary {
color: #777;
background-color: #f8f9fa;
border-color: #e6e6e6;
}
.btn-secondary:hover {
color: #555;
background-color: #f1f1f1;
border-color: #d9d9d9;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
transform: translateY(-3px);
}
.btn-outline-primary {
color: #ff8da1;
background-color: transparent;
border-color: #ff8da1;
}
.btn-outline-primary:hover {
color: #fff;
background-color: #ff8da1;
border-color: #ff8da1;
box-shadow: 0 4px 8px rgba(255, 141, 161, 0.2);
transform: translateY(-2px);
}
.btn i {
margin-right: 6px;
transition: transform 0.3s ease;
}
.btn:hover i {
transform: translateX(-3px);
}
/* 禁用状态 */
.btn:disabled,
.btn.disabled {
opacity: 0.65;
cursor: not-allowed;
transform: none !important;
box-shadow: none !important;
}
/* 提示信息 */
.alert {
position: relative;
padding: 14px 20px;
margin-bottom: 25px;
border: 1px solid transparent;
border-radius: 8px;
animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}
.alert-danger {
color: #ff5c77;
background-color: #fff0f3;
border-color: #ffe0e5;
}
/* 装饰元素 */
.form-card::before {
content: "";
position: absolute;
top: -15px;
right: 30px;
width: 40px;
height: 40px;
background-color: #ffeaef;
border-radius: 50%;
z-index: -1;
opacity: 0.8;
animation: float 6s ease-in-out infinite;
}
.form-card::after {
content: "";
position: absolute;
bottom: -20px;
left: 50px;
width: 60px;
height: 60px;
background-color: #ffeaef;
border-radius: 50%;
z-index: -1;
opacity: 0.6;
animation: float 7s ease-in-out infinite reverse;
}
/* 修复选择框问题 */
s/* 专门修复下拉框文字显示问题 */
select.form-control {
/* 保持一致的外观 */
appearance: none;
-webkit-appearance: none;
-moz-appearance: none;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23ff8da1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
background-repeat: no-repeat;
background-position: right 12px center;
background-size: 16px;
/* 修正文字显示问题 */
padding: 12px 40px 12px 15px; /* 增加右侧内边距,确保文字不被箭头遮挡 */
text-overflow: ellipsis; /* 如果文字太长会显示省略号 */
white-space: nowrap; /* 防止文本换行 */
color: #555 !important; /* 强制文本颜色 */
font-weight: normal;
line-height: 1.5;
position: relative;
z-index: 1;
}
/* 确保选定的选项能被完整显示 */
select.form-control option {
padding: 10px 15px;
color: #555;
background-color: #fff;
font-size: 15px;
line-height: 1.5;
}
/* 针对特定浏览器的修复 */
@-moz-document url-prefix() {
select.form-control {
color: #555;
text-indent: 0;
text-overflow: clip;
}
}
/* 针对Safari的修复 */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
select.form-control {
text-indent: 1px;
text-overflow: clip;
}
}
/* 设置选中文本的样式 */
select.form-control:focus option:checked {
background: #ffeaef;
color: #555;
}
/* 修复IE特定问题 */
select::-ms-expand {
display: none;
}
/* 确保选项在下拉框中正确展示 */
select.form-control option {
font-weight: normal;
}
/* 解决Chrome中的问题 */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
select.form-control {
border-radius: 8px;
}
}
/* 更明确地设置选择状态的样式 */
select.form-control {
border: 1.5px solid #ffd1dc;
background-color: #fff;
}
select.form-control:focus {
border-color: #ff8da1;
outline: 0;
box-shadow: 0 0 0 3px rgba(255, 141, 161, 0.25);
}
/* 尝试不同的方式设置下拉箭头 */
.select-wrapper {
position: relative;
display: block;
width: 100%;
}
.select-wrapper::after {
content: '⌄';
font-size: 24px;
color: #ff8da1;
position: absolute;
right: 15px;
top: 50%;
transform: translateY(-50%);
pointer-events: none;
}
/* 移除自定义背景图,改用伪元素作为箭头 */
select.form-control {
background-image: none;
}
/* 美化表单分组 */
.form-card {
position: relative;
overflow: hidden;
}
.form-group {
position: relative;
z-index: 1;
transition: transform 0.3s ease;
}
.form-group:hover {
transform: translateX(5px);
}
/* 甜美风格的表单组分隔线 */
.form-group:not(:last-child):after {
content: "";
display: block;
height: 1px;
width: 0;
background: linear-gradient(to right, transparent, #ffe0e8, transparent);
margin-top: 22px;
transition: width 0.5s ease;
}
.form-group:not(:last-child):hover:after {
width: 100%;
}
/* 必填项标记美化 */
.form-group.required label {
position: relative;
}
.form-group.required label:after {
content: " *";
color: #ff6b8b;
font-size: 18px;
line-height: 0;
position: relative;
top: 5px;
transition: all 0.3s ease;
}
.form-group.required:hover label:after {
color: #ff3958;
transform: scale(1.2);
}
/* 美化滚动条 */
::-webkit-scrollbar {
width: 8px;
}
::-webkit-scrollbar-track {
background: #fff;
}
::-webkit-scrollbar-thumb {
background-color: #ffc0cb;
border-radius: 20px;
border: 2px solid #fff;
}
::-webkit-scrollbar-thumb:hover {
background-color: #ff8da1;
}
/* 添加动画 */
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
@keyframes slideInRight {
from { opacity: 0; transform: translateX(20px); }
to { opacity: 1; transform: translateX(0); }
}
@keyframes slideInDown {
from { opacity: 0; transform: translateY(-20px); }
to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInUp {
from { opacity: 0; transform: translateY(20px); }
to { opacity: 1; transform: translateY(0); }
}
@keyframes float {
0% {
transform: translateY(0px);
}
50% {
transform: translateY(-15px);
}
100% {
transform: translateY(0px);
}
}
@keyframes pulse {
0% {
transform: scale(1);
}
50% {
transform: scale(1.05);
}
100% {
transform: scale(1);
}
}
@keyframes shake {
10%, 90% {
transform: translateX(-1px);
}
20%, 80% {
transform: translateX(2px);
}
30%, 50%, 70% {
transform: translateX(-3px);
}
40%, 60% {
transform: translateX(3px);
}
}
/* 响应式设计 */
@media (max-width: 768px) {
.form-actions {
flex-direction: column;
align-items: center;
}
.input-with-button {
flex-direction: column;
}
.page-header {
flex-direction: column;
align-items: flex-start;
}
.page-header .actions {
margin-top: 12px;
}
.btn {
width: 100%;
}
}
/* 表单光影效果 */
.form-card {
position: relative;
overflow: hidden;
}
.form-card:before, .form-card:after {
content: "";
position: absolute;
z-index: -1;
}
/* 移入表单时添加光晕效果 */
.form-card:hover:before {
content: "";
position: absolute;
top: -50%;
left: -50%;
width: 200%;
height: 200%;
background: radial-gradient(circle, rgba(255,232,238,0.3) 0%, rgba(255,255,255,0) 70%);
animation: glowEffect 2s infinite linear;
}
@keyframes glowEffect {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
/* 输入焦点时的动画 */
.form-control:focus {
animation: focusPulse 1s infinite alternate;
}
@keyframes focusPulse {
from {
box-shadow: 0 0 0 3px rgba(255, 141, 161, 0.25);
}
to {
box-shadow: 0 0 0 5px rgba(255, 141, 161, 0.15);
}
}