/* === 基础样式 === */
* { box-sizing: border-box; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }
.sidebar { background: linear-gradient(180deg, #1F2937 0%, #111827 100%); }
.nav-item { transition: all 0.2s; color: white; }
.nav-item:hover { background: rgba(59, 130, 246, 0.1); }
.nav-item.active { background: rgba(59, 130, 246, 0.15); border-left-color: #3B82F6; }
.card { background: white; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.stats-card { background: linear-gradient(135deg, #3B82F6 0%, #1D4ED8 100%); }
.btn-primary { background: #3B82F6; transition: all 0.2s; }
.btn-primary:hover { background: #2563EB; transform: translateY(-1px); }
.input { border: 1px solid #E5E7EB; transition: all 0.2s; }
.input:focus { border-color: #3B82F6; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1); }
.modal { backdrop-filter: blur(4px); }
.modal-content { animation: slideUp 0.2s ease-out; }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.tag { display: inline-block; padding: 2px 10px; border-radius: 9999px; font-size: 12px; font-weight: 500; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 0; bottom: 0; width: 2px; background: linear-gradient(180deg, #3B82F6 0%, #E5E7EB 100%); }
.timeline-item { position: relative; }
.timeline-item::before { content: ''; position: absolute; left: -20px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: white; border: 3px solid #3B82F6; }
.chat-bubble { max-width: 80%; padding: 12px 16px; border-radius: 16px; margin-bottom: 8px; line-height: 1.5; }
.chat-user { background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%); color: white; border-bottom-right-radius: 4px; margin-left: auto; }
.chat-assistant { background: #F3F4F6; color: #111827; border-bottom-left-radius: 4px; }
.progress-bar { height: 8px; border-radius: 4px; background: #E5E7EB; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, #3B82F6 0%, #60A5FA 100%); transition: width 0.3s; }
.fade-in { animation: fadeIn 0.3s ease-out; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* === 响应式 === */
@media (max-width: 768px) {
    .sidebar { position: fixed; left: -280px; z-index: 100; width: 280px; }
    .sidebar.open { left: 0; }
    .main-content { margin-left: 0 !important; padding: 1rem; }
    .mobile-toggle { display: flex !important; }
}
.mobile-toggle { display: none; }
.section-content { display: none; }
.section-content.active { display: block; }

/* === 卡片与组件 === */
.ability-card { border: 1px solid #E5E7EB; border-radius: 12px; padding: 20px; transition: all 0.2s; background: white; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.ability-card:hover { border-color: #3B82F6; box-shadow: 0 4px 12px rgba(59, 130, 246, 0.12); transform: translateY(-1px); }
.star { color: #FCD34D; }
.search-highlight { background: #FEF3C7; padding: 0 2px; border-radius: 2px; }
.fixed-table-container { max-height: 600px; overflow-y: auto; }
.memo-card, .project-card { height: 280px; display: flex; flex-direction: column; overflow: hidden; }
.memo-card, .project-card, .project-card-content, .memo-content { word-wrap: break-word; overflow-wrap: break-word; word-break: break-word; }
.memo-content, .project-card-content { flex: 1; overflow-y: auto; min-height: 0; word-break: break-word; overflow-wrap: break-word; line-height: 1.6; }

/* === 统一卡片样式 === */
.item-card { background: white; border-radius: 12px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); transition: all 0.2s; border: 1px solid #F3F4F6; }
.item-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); transform: translateY(-1px); }

/* === 统一操作按钮样式 === */
.btn-action { padding: 4px 12px; font-size: 12px; border-radius: 6px; transition: all 0.15s; white-space: nowrap; }
.btn-view { background: #ECFDF5; color: #059669; }
.btn-view:hover { background: #D1FAE5; }
.btn-edit { background: #EFF6FF; color: #2563EB; }
.btn-edit:hover { background: #DBEAFE; }
.btn-del { background: #FEF2F2; color: #DC2626; }
.btn-del:hover { background: #FEE2E2; }
.btn-action-group { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }

/* === 统一空状态样式 === */
.empty-state { text-align: center; padding: 48px 16px; color: #9CA3AF; font-size: 14px; }
.empty-state i { font-size: 32px; margin-bottom: 12px; display: block; opacity: 0.4; }

/* === 统一标签样式 === */
.tag-blue { background: #DBEAFE; color: #1E40AF; }
.tag-green { background: #D1FAE5; color: #065F46; }
.tag-yellow { background: #FEF3C7; color: #92400E; }
.tag-red { background: #FEE2E2; color: #991B1B; }
.tag-gray { background: #F3F4F6; color: #374151; }
.tag-purple { background: #EDE9FE; color: #5B21B6; }

/* === 统一分页样式 === */
.pagination-wrap { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; padding-top: 16px; border-top: 1px solid #F3F4F6; }
.pagination-info { font-size: 14px; color: #6B7280; }
.pagination-btn { padding: 6px 16px; font-size: 14px; border-radius: 6px; transition: all 0.15s; }
.pagination-btn:not(:disabled) { background: #F3F4F6; color: #374151; }
.pagination-btn:not(:disabled):hover { background: #E5E7EB; }
.pagination-btn:disabled { background: #F9FAFB; color: #D1D5DB; cursor: not-allowed; }

/* === 统一表格头样式 === */
.table-header { background: #F9FAFB; }
.table-header th { padding: 12px 16px; text-align: left; font-size: 12px; font-weight: 600; color: #6B7280; text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid #E5E7EB; }
.table-row { border-bottom: 1px solid #F3F4F6; transition: background 0.15s; }
.table-row:hover { background: #F9FAFB; }
.table-row td { padding: 12px 16px; font-size: 14px; }
.milestone-group { border: 1px solid #E5E7EB; border-radius: 8px; padding: 16px; margin-bottom: 16px; }

/* === 表格样式优化 === */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 12px 8px; text-align: left; vertical-align: middle; }
.data-table th { font-weight: 600; color: #374151; border-bottom: 2px solid #E5E7EB; position: sticky; top: 0; background: white; z-index: 10; }
.data-table td { border-bottom: 1px solid #F3F4F6; word-wrap: break-word; overflow-wrap: break-word; white-space: normal; max-width: 0; }
.data-table tr:hover td { background-color: #F9FAFB; }
.btn-group { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; }
.btn-group button { white-space: nowrap; }
@media (max-width: 768px) {
    .data-table th, .data-table td { padding: 8px 4px; font-size: 14px; }
    .btn-group button { padding: 4px 8px; font-size: 12px; }
}

/* === Toast 通知 === */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast-item { padding: 12px 20px; border-radius: 10px; color: #fff; font-size: 14px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); animation: toastIn 0.3s ease-out; display: flex; align-items: center; gap: 8px; max-width: 380px; word-break: break-word; }
.toast-item.info { background: #3B82F6; }
.toast-item.success { background: #10B981; }
.toast-item.warning { background: #F59E0B; }
.toast-item.error { background: #EF4444; }
.toast-close { cursor: pointer; opacity: 0.7; margin-left: auto; font-size: 18px; line-height: 1; flex-shrink: 0; }
.toast-close:hover { opacity: 1; }
@keyframes toastIn { from { opacity: 0; transform: translateX(100px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(100px); } }

/* === 全局表格 === */
table { width: 100%; border-collapse: collapse; margin: 1em 0; }
table td, table th { border: 1px solid #ddd; padding: 8px; text-align: left; }
table th { background-color: #f5f5f5; font-weight: bold; }
table tr:nth-child(even) { background-color: #fafafa; }

/* === 加载状态 === */
.loading-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(255,255,255,0.6); backdrop-filter: blur(2px); z-index: 9000; display: none; align-items: center; justify-content: center; }
.loading-overlay.show { display: flex; }
.loading-spinner { width: 40px; height: 40px; border: 4px solid #E5E7EB; border-top-color: #3B82F6; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-loading { position: relative; pointer-events: none; opacity: 0.7; }
.btn-loading::after { content: ''; position: absolute; top: 50%; left: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff; border-radius: 50%; animation: spin 0.6s linear infinite; }

/* === 深色模式 === */
[data-theme="dark"] { color-scheme: dark; }
[data-theme="dark"] body { background: #0F172A; color: #E2E8F0; }
[data-theme="dark"] .card { background: #1E293B; box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
[data-theme="dark"] .item-card { background: #1E293B; border-color: #334155; box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
[data-theme="dark"] .item-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.4); }
[data-theme="dark"] .input { background: #334155; border-color: #475569; color: #E2E8F0; }
[data-theme="dark"] .input:focus { border-color: #3B82F6; }
[data-theme="dark"] .table-header { background: #1E293B; }
[data-theme="dark"] .table-header th { color: #94A3B8; border-bottom-color: #334155; }
[data-theme="dark"] .table-row { border-bottom-color: #334155; }
[data-theme="dark"] .table-row:hover { background: #334155; }
[data-theme="dark"] .table-row td { color: #E2E8F0; }
[data-theme="dark"] .data-table th { background: #1E293B; color: #E2E8F0; border-bottom-color: #334155; }
[data-theme="dark"] .data-table td { border-bottom-color: #334155; color: #E2E8F0; }
[data-theme="dark"] .data-table tr:hover td { background-color: #334155; }
[data-theme="dark"] .modal-content { background: #1E293B; color: #E2E8F0; }
[data-theme="dark"] .chat-assistant { background: #334155; color: #E2E8F0; }
[data-theme="dark"] .loading-overlay { background: rgba(15,23,42,0.6); }
[data-theme="dark"] .pagination-btn:not(:disabled) { background: #334155; color: #E2E8F0; }
[data-theme="dark"] .pagination-btn:not(:disabled):hover { background: #475569; }
[data-theme="dark"] .pagination-btn:disabled { background: #1E293B; color: #475569; }
[data-theme="dark"] .ability-card { background: #1E293B; border-color: #334155; }
[data-theme="dark"] .timeline-item::before { background: #1E293B; }
[data-theme="dark"] table th { background-color: #334155; color: #E2E8F0; }
[data-theme="dark"] table tr:nth-child(even) { background-color: #1E293B; }
[data-theme="dark"] table td, [data-theme="dark"] table th { border-color: #334155; }
[data-theme="dark"] .main-content { background: #0F172A; }
[data-theme="dark"] .text-gray-600, [data-theme="dark"] .text-gray-700 { color: #94A3B8 !important; }
[data-theme="dark"] .text-gray-900 { color: #E2E8F0 !important; }
[data-theme="dark"] .bg-gray-50 { background-color: #1E293B !important; }
[data-theme="dark"] .bg-white { background-color: #1E293B !important; }
[data-theme="dark"] .border-gray-200 { border-color: #334155 !important; }

/* === 主题切换按钮 === */
.theme-toggle { position: fixed; bottom: 20px; right: 20px; z-index: 9999; width: 44px; height: 44px; border-radius: 50%; background: #3B82F6; color: white; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(59,130,246,0.3); transition: all 0.3s; }
.theme-toggle:hover { transform: scale(1.1); }

/* === 富文本内容展示 === */
.content-html { line-height: 1.7; word-break: break-word; overflow-wrap: break-word; }
.content-html p { margin-bottom: 0.75em; }
.content-html ul, .content-html ol { margin: 0.5em 0; padding-left: 1.5em; }
.content-html li { margin-bottom: 0.25em; }
.content-html h1, .content-html h2, .content-html h3, .content-html h4 { margin: 1em 0 0.5em; font-weight: 600; }
.content-html h1 { font-size: 1.5em; }
.content-html h2 { font-size: 1.25em; }
.content-html h3 { font-size: 1.1em; }
.content-html blockquote { border-left: 3px solid #3B82F6; padding-left: 1em; margin: 0.5em 0; color: #6B7280; }
.content-html pre { background: #F3F4F6; padding: 1em; border-radius: 8px; overflow-x: auto; margin: 0.5em 0; }
.content-html code { background: #F3F4F6; padding: 0.15em 0.3em; border-radius: 3px; font-size: 0.9em; }
.content-html pre code { background: none; padding: 0; }
.content-html img { max-width: 100%; height: auto; border-radius: 8px; margin: 0.5em 0; }
.content-html table { width: 100%; border-collapse: collapse; margin: 0.5em 0; }
.content-html th, .content-html td { border: 1px solid #E5E7EB; padding: 8px; text-align: left; }
.content-html th { background: #F9FAFB; font-weight: 600; }
.content-html a { color: #3B82F6; text-decoration: underline; }
