/* ========== 全局样式 ========== */
:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #eef2ff;
    --secondary: #06b6d4;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --text-dark: #1f2937;
    --text-gray: #6b7280;
    --text-light: #9ca3af;
    --bg-gray: #f9fafb;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background-color: #f5f7fb;
    color: var(--text-dark);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
}

.bg-gradient-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* 公告条 */
.announcement-bar {
    background: #fffbeb;
    border-bottom: 1px solid #fde68a;
    color: #92400e;
    font-size: 0.9rem;
}
.announcement-bar .badge {
    font-size: 0.7rem;
}

/* 导航栏 */
.navbar-dark .navbar-nav .nav-link {
    color: rgba(255,255,255,.9);
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.2s;
}
.navbar-dark .navbar-nav .nav-link:hover,
.navbar-dark .navbar-nav .nav-link.active {
    color: #fff;
    background: rgba(255,255,255,.15);
    border-radius: 0.5rem;
}

/* Avatar */
.avatar-sm { width: 28px; height: 28px; object-fit: cover; }
.avatar-md { width: 48px; height: 48px; object-fit: cover; }
.avatar-lg { width: 80px; height: 80px; object-fit: cover; }
.avatar-xl { width: 120px; height: 120px; object-fit: cover; }

/* 卡片阴影 */
.card {
    border: none;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    transition: all 0.25s ease;
    border-radius: 0.75rem;
    overflow: hidden;
}
.card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,.1);
    transform: translateY(-2px);
}
.card-img-top {
    height: 160px;
    object-fit: cover;
}

/* 项目卡片 */
.project-card .tech-tags .badge {
    font-size: 0.7rem;
    margin-right: 0.25rem;
    font-weight: 400;
}
.project-card .card-title {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.project-card .card-text {
    font-size: 0.85rem;
    color: var(--text-gray);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.4em;
}

/* 页脚 */
.footer { flex-shrink: 0; }
.text-light-50 { color: rgba(255,255,255,.6); }
.hover-white:hover { color: #fff; }

/* 返回顶部 */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 44px;
    height: 44px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 999;
    box-shadow: 0 4px 12px rgba(79,70,229,.4);
}
.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

/* 搜索输入框 */
.input-group input::placeholder {
    color: var(--text-light);
}

/* 状态徽章 */
.status-pending { background: #fef3c7; color: #92400e; }
.status-approved { background: #d1fae5; color: #065f46; }
.status-rejected { background: #fee2e2; color: #991b1b; }
.status-open { background: #dbeafe; color: #1e40af; }
.status-assigned { background: #e0e7ff; color: #3730a3; }
.status-working { background: #fef3c7; color: #92400e; }
.status-delivered { background: #ede9fe; color: #5b21b6; }
.status-completed { background: #d1fae5; color: #065f46; }
.status-cancelled { background: #fee2e2; color: #991b1b; }
.status-paid { background: #d1fae5; color: #065f46; }

/* 分类徽章 */
.badge-category {
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    border-radius: 0.375rem;
}

/* 统计卡片 */
.stat-card {
    padding: 1.5rem;
    border-radius: 1rem;
    background: #fff;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,.05);
}
.stat-card .stat-icon {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 3rem;
    opacity: 0.1;
}
.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}
.stat-card .stat-label {
    font-size: 0.875rem;
    color: var(--text-gray);
}

/* 轮播/横幅 */
.hero-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 4rem 0;
    position: relative;
    overflow: hidden;
}
.hero-section::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: rgba(255,255,255,.08);
    border-radius: 50%;
    top: -200px;
    right: -150px;
}
.hero-section::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: rgba(255,255,255,.06);
    border-radius: 50%;
    bottom: -150px;
    left: -100px;
}

/* 按钮悬停 */
.btn { transition: all 0.2s; }
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}
.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79,70,229,.3);
}

/* 富文本/Markdown渲染容器 */
.post-content {
    line-height: 1.8;
    font-size: 0.95rem;
}
.post-content p { margin-bottom: 1rem; }
.post-content img { max-width: 100%; border-radius: 0.5rem; }
.post-content pre {
    background: #1e293b;
    padding: 1rem;
    border-radius: 0.5rem;
    color: #e2e8f0;
    overflow-x: auto;
}
.post-content code {
    background: #f1f5f9;
    padding: 0.15rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.9em;
}
.post-content h1, .post-content h2, .post-content h3 {
    margin: 1.5rem 0 1rem;
    font-weight: 600;
}
.post-content ul, .post-content ol { padding-left: 1.5rem; }

/* 评论区 */
.comment-item {
    padding: 1rem 0;
    border-bottom: 1px solid #f3f4f6;
}
.comment-item:last-child { border-bottom: none; }

/* 标签 */
.tag-cloud .tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 999px;
    font-size: 0.8rem;
    margin: 0.25rem;
    text-decoration: none;
    transition: all 0.2s;
}
.tag-cloud .tag:hover {
    background: var(--primary);
    color: #fff;
}

/* 分页 */
.pagination .page-link {
    color: var(--primary);
    border-radius: 0.5rem;
    margin: 0 0.125rem;
    border: none;
    padding: 0.5rem 0.85rem;
}
.pagination .page-link:hover {
    background: var(--primary-light);
    color: var(--primary);
}
.pagination .page-item.active .page-link {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(79,70,229,.3);
}

/* 里程碑进度条 */
.milestone-item {
    position: relative;
    padding-left: 2.5rem;
    padding-bottom: 1.5rem;
}
.milestone-item::before {
    content: '';
    position: absolute;
    left: 11px;
    top: 28px;
    bottom: -10px;
    width: 2px;
    background: #e5e7eb;
}
.milestone-item:last-child::before { display: none; }
.milestone-dot {
    position: absolute;
    left: 0;
    top: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: #fff;
}
.milestone-dot.pending { background: #d1d5db; }
.milestone-dot.doing { background: var(--warning); animation: pulse 2s infinite; }
.milestone-dot.done { background: var(--success); }

@keyframes pulse {
    0%,100% { box-shadow: 0 0 0 0 rgba(245,158,11,.4); }
    50% { box-shadow: 0 0 0 8px rgba(245,158,11,0); }
}

/* 聊天消息 */
.chat-message {
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    margin-bottom: 0.75rem;
    max-width: 75%;
    word-break: break-word;
}
.chat-message.mine {
    background: var(--primary);
    color: #fff;
    margin-left: auto;
    border-bottom-right-radius: 0.25rem;
}
.chat-message.other {
    background: #f3f4f6;
    border-bottom-left-radius: 0.25rem;
}
.chat-message.system {
    background: #fef3c7;
    color: #92400e;
    text-align: center;
    max-width: 100%;
    font-size: 0.85rem;
    padding: 0.5rem;
}

/* 需求卡片 */
.demand-card .budget {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--danger);
}

/* 列表工具栏 */
.filter-bar {
    background: #fff;
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-gray);
}
.empty-state i {
    font-size: 4rem;
    opacity: 0.2;
    margin-bottom: 1rem;
    display: block;
}

/* 后台布局 */
.admin-sidebar {
    width: 240px;
    min-height: 100vh;
    background: #1f2937;
    color: #fff;
    position: fixed;
    left: 0;
    top: 0;
    padding-top: 1rem;
    z-index: 1000;
}
.admin-sidebar .nav-link {
    color: #d1d5db;
    padding: 0.7rem 1.5rem;
    border-left: 3px solid transparent;
    transition: all 0.2s;
}
.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link.active {
    background: #374151;
    color: #fff;
    border-left-color: var(--primary);
}
.admin-main {
    margin-left: 240px;
    min-height: 100vh;
    padding: 1.5rem 2rem;
    background: #f3f4f6;
}
@media (max-width: 768px) {
    .admin-sidebar { width: 70px; }
    .admin-sidebar .nav-text { display: none; }
    .admin-main { margin-left: 70px; padding: 1rem; }
}

.admin-stat-card {
    background: #fff;
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.admin-stat-card .value {
    font-size: 2rem;
    font-weight: 700;
}
.admin-stat-card .label {
    font-size: 0.875rem;
    color: var(--text-gray);
}
.admin-stat-card .icon {
    width: 48px;
    height: 48px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff;
}

/* 表单优化 */
.form-control, .form-select {
    border-radius: 0.5rem;
    border-color: #d1d5db;
}
.form-control:focus, .form-select:focus {
    box-shadow: 0 0 0 3px rgba(79,70,229,.15);
    border-color: var(--primary);
}

/* 定价标签 */
.price-tag {
    color: var(--danger);
    font-weight: 700;
}
.price-tag.free {
    color: var(--success);
}
