:root { /* 基础颜色变量 */ --primary-color: #2196F3; --primary-dark: #1976D2; --primary-color-alpha: rgba(33, 150, 243, 0.1); --success-color: #4CAF50; --error-color: #F44336; --background-color: #F5F5F5; --card-background: #FFFFFF; --text-primary: #333333; --text-secondary: #757575; --border-color: #e0e0e0; --disabled-bg: #f5f5f5; /* 布局变量 */ --border-radius: 8px; --spacing: 20px; /* 动画变量 */ --transition-fast: 0.2s; --transition-slow: 0.3s; } /* 暗色模式 */ @media (prefers-color-scheme: dark) { :root { --primary-color: #90CAF9; --primary-dark: #64B5F6; --background-color: #121212; --card-background: #1e1e1e; --text-primary: #e0e0e0; --text-secondary: #9e9e9e; --border-color: #404040; --disabled-bg: #2d2d2d; color-scheme: dark; } } /* 基础样式 */ html { scroll-behavior: smooth; box-sizing: border-box; } *, *:before, *:after { box-sizing: inherit; } body { font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; max-width: 1200px; margin: 0 auto; padding: var(--spacing); background: var(--background-color); color: var(--text-primary); line-height: 1.6; } /* 容器样式 */ .container { background: var(--card-background); padding: var(--spacing); border-radius: var(--border-radius); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); margin-bottom: var(--spacing); transition: transform var(--transition-fast); } .container:hover { transform: translateY(-2px); } /* 标题样式 */ h1, h2, h3 { color: var(--text-primary); margin-top: 0; line-height: 1.2; } /* 表单元素样式 */ .form-group { margin-bottom: 20px; } /* 标签样式 */ label { display: block; margin-bottom: 8px; font-weight: 500; color: var(--text-primary); } input, select, textarea, .form-control { width: 100%; padding: 10px 12px; border: 1px solid var(--border-color); border-radius: 4px; background: var(--card-background); color: var(--text-primary); font-size: 14px; line-height: 1.5; transition: all var(--transition-fast); appearance: none; } input[type="checkbox"] { width: auto; margin-right: 8px; cursor: pointer; appearance: auto; } input[type="checkbox"]+label { cursor: pointer; color: var(--text-primary); user-select: none; } input:hover, select:hover, textarea:hover, .form-control:hover { border-color: var(--primary-color); } input:focus, select:focus, textarea:focus, .form-control:focus { border-color: var(--primary-color); box-shadow: 0 0 0 2px var(--primary-color-alpha); outline: none; } /* 禁用状态 */ input:disabled, select:disabled, textarea:disabled, .form-control:disabled { background-color: var(--disabled-bg); border-color: var(--border-color); cursor: not-allowed; opacity: 0.7; } /* 错误状态 */ input.error, select.error, textarea.error, .form-control.error { border-color: var(--error-color); } /* Select 特殊样式 */ select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23757575'%3E%3Cpath d='M7 10l5 5 5-5H7z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; background-size: 20px; padding-right: 36px; } /* Textarea 特殊样式 */ textarea { min-height: 150px; resize: vertical; font-family: monospace; line-height: 1.4; } /* 按钮基础样式 */ button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 24px; border: none; border-radius: var(--border-radius); background: var(--primary-color); color: white; font-size: 16px; font-weight: 500; text-align: center; text-decoration: none; cursor: pointer; transition: all var(--transition-fast); user-select: none; -webkit-tap-highlight-color: transparent; } /* 按钮状态 */ button:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px var(--primary-color-alpha); } button:active { transform: translateY(1px); } button:disabled { background: var(--disabled-bg); color: var(--text-secondary); cursor: not-allowed; transform: none; box-shadow: none; } /* 次要按钮样式 */ button.secondary { background: transparent; border: 1px solid var(--primary-color); color: var(--primary-color); } button.secondary:hover { background: var(--primary-color-alpha); border-color: var(--primary-dark); color: var(--primary-dark); } button.danger { background: var(--error-color); border: none; } button.danger:hover { background: #d32f2f; /* 深红色 */ box-shadow: 0 4px 12px rgba(244, 67, 54, 0.2); } /* 激活状态的按钮 */ button.active { background: var(--primary-dark); box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1); transform: translateY(1px); } button.secondary.active { background: var(--primary-color); color: white; border-color: var(--primary-dark); } /* 按钮组 */ .button-group { display: flex; gap: 10px; margin: var(--spacing) 0; } /* 按钮组中的按钮间距调整 */ .button-group button { flex: 1; min-width: 120px; } /* 消息容器 - 固定在顶部中间 */ .message-container { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; align-items: center; pointer-events: none; /* 允许点击穿透 */ } /* 单个消息样式 */ .message { padding: 12px 20px; border-radius: 4px; background: var(--card-background); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); margin-bottom: 10px; pointer-events: auto; /* 允许消息本身可以交互 */ min-width: 300px; max-width: 500px; display: flex; align-items: center; transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1); animation: messageIn 0.3s ease-in-out; } .message.success { background: #f0f9eb; border: 1px solid #e1f3d8; } .message.error { background: #fef0f0; border: 1px solid #fde2e2; } @keyframes messageIn { 0% { opacity: 0; transform: translateY(-20px); } 100% { opacity: 1; transform: translateY(0); } } @keyframes messageOut { 0% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; transform: translateY(-20px); } } /* 深色模式适配 */ @media (prefers-color-scheme: dark) { .message { background: #2c2c2c; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3); } .message.success { background: #294929; border-color: #1c321c; } .message.error { background: #4d2c2c; border-color: #321c1c; } } /* 表格样式 */ table { width: 100%; border-collapse: collapse; margin-top: var(--spacing); background: var(--card-background); border-radius: var(--border-radius); overflow: hidden; } th, td { padding: 12px; text-align: left; border-bottom: 1px solid var(--text-secondary); } th { background: var(--primary-color); color: white; font-weight: 500; } tr:nth-child(even) { background: rgba(0, 0, 0, 0.02); } tr:hover { background: rgba(0, 0, 0, 0.04); } /* 辅助类 */ .visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; } .text-center { text-align: center; } .help-text { margin-top: 4px; font-size: 14px; color: var(--text-secondary); } .error-text { color: var(--error-color); } .mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; } /* 响应式设计 */ @media (max-width: 768px) { :root { --spacing: 16px; } body { padding: 10px; } .button-group { flex-direction: column; } button { width: 100%; padding: 12px 20px; } input, select, textarea, .form-control { font-size: 16px; padding: 14px 16px; } table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; } th, td { white-space: nowrap; } }