Files

216 lines
4.7 KiB
CSS

@tailwind base;
@tailwind components;
@tailwind utilities;
/* 基础样式 */
body {
@apply bg-gray-50 text-gray-900 dark:bg-gray-900 dark:text-gray-100;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
/* 隐藏 html 和 body 的滚动条,但保持滚动功能 */
html, body {
scrollbar-width: none; /* Firefox */
-ms-overflow-style: none; /* IE and Edge */
}
html::-webkit-scrollbar,
body::-webkit-scrollbar {
display: none; /* Chrome, Safari, Opera */
}
/* 其他元素的滚动条样式 */
*:not(html):not(body)::-webkit-scrollbar {
width: 8px;
height: 8px;
}
*:not(html):not(body)::-webkit-scrollbar-track {
@apply bg-gray-100 dark:bg-gray-800;
}
*:not(html):not(body)::-webkit-scrollbar-thumb {
@apply bg-gray-300 dark:bg-gray-600 rounded-full;
}
*:not(html):not(body)::-webkit-scrollbar-thumb:hover {
@apply bg-gray-400 dark:bg-gray-500;
}
/* 图片加载占位 */
.image-placeholder {
@apply bg-gray-200 dark:bg-gray-700 animate-pulse;
}
/* 按钮基础样式 */
.btn {
@apply px-4 py-2 rounded-lg font-medium transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed;
}
.btn-primary {
@apply btn bg-primary-600 text-white hover:bg-primary-700 focus:ring-primary-500;
}
.btn-secondary {
@apply btn bg-gray-200 text-gray-800 hover:bg-gray-300 dark:bg-gray-700 dark:text-gray-200 dark:hover:bg-gray-600 focus:ring-gray-500;
}
.btn-danger {
@apply btn bg-red-600 text-white hover:bg-red-700 focus:ring-red-500;
}
.btn-ghost {
@apply btn bg-transparent hover:bg-gray-100 dark:hover:bg-gray-800;
}
/* 输入框样式 */
.input {
@apply w-full px-4 py-2 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent transition-all duration-200;
}
/* 下拉选择框样式 */
select.input {
@apply pr-10 appearance-none cursor-pointer;
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
background-position: right 0.75rem center;
background-repeat: no-repeat;
background-size: 1.25em 1.25em;
}
.dark select.input {
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%239ca3af' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
}
/* 卡片样式 */
.card {
@apply bg-white dark:bg-gray-800 rounded-xl shadow-sm border border-gray-200 dark:border-gray-700;
}
/* 页面过渡动画 */
.page-enter-active,
.page-leave-active {
transition: all 0.2s;
}
.page-enter-from,
.page-leave-to {
opacity: 0;
transform: translateY(10px);
}
/* Toast 动画 */
.toast-enter-active {
animation: toast-in 0.3s ease-out;
}
.toast-leave-active {
animation: toast-out 0.3s ease-in forwards;
}
.toast-move {
transition: transform 0.3s ease;
}
@keyframes toast-in {
from {
opacity: 0;
transform: translateY(-20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes toast-out {
from {
opacity: 1;
transform: translateY(0);
}
to {
opacity: 0;
transform: translateY(-20px);
}
}
/* 图片查看器过渡 */
.viewer-enter-active,
.viewer-leave-active {
transition: all 0.3s ease;
}
.viewer-enter-from,
.viewer-leave-to {
opacity: 0;
}
.viewer-enter-from .viewer-image,
.viewer-leave-to .viewer-image {
transform: scale(0.9);
}
/* 瀑布流布局 */
.masonry-grid {
display: flex;
margin-left: -16px;
width: auto;
}
.masonry-grid-column {
padding-left: 16px;
background-clip: padding-box;
}
/* 移动端适配 */
@media (max-width: 640px) {
.masonry-grid {
margin-left: -8px;
}
.masonry-grid-column {
padding-left: 8px;
}
}
/* 暗黑模式下的 focus ring offset */
.dark .btn:focus {
--tw-ring-offset-color: #111827;
}
.dark .input:focus {
--tw-ring-offset-color: #111827;
}
/* 选择框样式 */
input[type="range"] {
@apply accent-primary-600;
}
/* 隐藏数字输入框的上下按钮 */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
input[type="number"] {
-moz-appearance: textfield;
}
/* 链接悬停效果 */
a {
@apply transition-colors;
}
/* 禁用状态 */
.disabled {
@apply opacity-50 cursor-not-allowed pointer-events-none;
}
/* 主题切换过渡效果 */
::view-transition-old(root),
::view-transition-new(root) {
animation: none;
mix-blend-mode: normal;
}