/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition-fast: 0.15s ease;
    --transition-base: 0.2s ease;
    --transition-slow: 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    line-height: 1.7;
    color: var(--text-primary);
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    min-height: 100vh;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-hover);
    text-decoration: none;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

/* 头部样式 */
.header {
    background: linear-gradient(to right, #ffffff 0%, #f8fafc 100%);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
}

.header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    height: 72px;
}

.logo a {
    text-decoration: none;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo h1 {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 0;
    background: linear-gradient(135deg, var(--primary-color) 0%, #7c3aed 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.logo .tagline {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 2px;
}

.nav {
    display: flex;
    gap: 8px;
}

.nav a {
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 500;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.nav a:hover {
    color: var(--primary-color);
    background: var(--primary-light);
}

.user-menu a,
.auth-menu a {
    margin-left: 8px;
}

.btn-login,
.btn-register {
    display: inline-block;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: all var(--transition-fast);
}

.btn-login {
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border-color);
}

.btn-login:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background: var(--primary-light);
}

.btn-register {
    background: linear-gradient(135deg, var(--primary-color) 0%, #6366f1 100%);
    color: #fff;
    box-shadow: var(--shadow-sm);
}

.btn-register:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, #4f46e5 100%);
    color: #fff;
    text-decoration: none;
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

/* 主布局 */
.main-content {
    width: calc(100% - 320px);
    float: left;
    padding-top: 24px;
}

.sidebar {
    width: 300px;
    float: right;
    padding-top: 24px;
}

.container::after {
    content: "";
    display: table;
    clear: both;
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    text-align: center;
    transition: all var(--transition-fast);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #6366f1 100%);
    color: #fff;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, #4f46e5 100%);
    color: #fff;
    text-decoration: none;
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-secondary {
    background: #fff;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background: var(--primary-light);
    text-decoration: none;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #dc2626 100%);
    color: #fff;
    box-shadow: var(--shadow-sm);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: #fff;
    box-shadow: var(--shadow-md);
}

.btn-block {
    display: block;
    width: 100%;
}

/* 表单样式 */
.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: all var(--transition-fast);
    background: #fff;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-group textarea {
    min-height: 120px;
    resize: vertical;
}

.hint {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* 认证框 */
.auth-box {
    max-width: 440px;
    margin: 60px auto;
    background: #fff;
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
}

.auth-box h2 {
    text-align: center;
    margin-bottom: 32px;
    color: var(--text-primary);
    font-size: 24px;
    font-weight: 700;
}

.auth-form {
    margin-bottom: 24px;
}

.auth-footer {
    text-align: center;
    color: var(--text-secondary);
}

/* 搜索栏 */
.search-section {
    background: linear-gradient(135deg, var(--primary-color) 0%, #7c3aed 100%);
    padding: 32px;
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.search-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
}

.search-section form {
    display: flex;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.search-section input {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-fast);
}

.search-section input:focus {
    outline: none;
    box-shadow: var(--shadow-lg);
    transform: scale(1.01);
}

.search-section input::placeholder {
    color: var(--text-muted);
}

.search-section button {
    padding: 14px 36px;
    background: #fff;
    color: var(--primary-color);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-fast);
}

.search-section button:hover {
    background: var(--primary-light);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

/* 区块样式 */
.section {
    background: #fff;
    padding: 28px;
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    transition: all var(--transition-base);
}

.section:hover {
    box-shadow: var(--shadow-lg);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--primary-light);
}

.section-header h2 {
    font-size: 20px;
    color: var(--text-primary);
    font-weight: 700;
}

/* 问题列表 */
.question-list {
    min-height: 320px;
}

.question-item {
    display: flex;
    padding: 24px 0;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    transition: all var(--transition-fast);
}

.question-item:hover {
    background: var(--primary-light);
    margin: 0 -28px;
    padding-left: 28px;
    padding-right: 28px;
}

.question-item:last-child {
    border-bottom: none;
}

.question-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 90px;
    margin-right: 20px;
    background: var(--bg-body);
    padding: 12px;
    border-radius: var(--radius-md);
    text-align: center;
}

.stat-item .number {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-item .label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.question-content {
    flex: 1;
}

.question-content h3 {
    font-size: 17px;
    margin-bottom: 12px;
    font-weight: 600;
    line-height: 1.5;
}

.question-content h3 a {
    color: var(--text-primary);
    transition: color var(--transition-fast);
}

.question-content h3 a:hover {
    color: var(--primary-color);
}

.question-meta {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 16px;
}

.question-meta span {
    display: flex;
    align-items: center;
}

.question-meta .category {
    background: var(--primary-light);
    color: var(--primary-color);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.tag.solved {
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
    color: #fff;
    box-shadow: var(--shadow-sm);
}

/* 小组列表 */
.group-item {
    padding: 24px 0;
    border-bottom: 1px solid var(--border-color);
    transition: all var(--transition-fast);
}

.group-item:hover {
    background: var(--primary-light);
    margin: 0 -28px;
    padding-left: 28px;
    padding-right: 28px;
}

.group-item:last-child {
    border-bottom: none;
}

.group-name {
    margin-bottom: 12px;
}

.group-name a {
    color: var(--text-primary);
    font-size: 19px;
    font-weight: 600;
    transition: color var(--transition-fast);
}

.group-name a:hover {
    color: var(--primary-color);
    text-decoration: none;
}

.group-desc {
    color: var(--text-secondary);
    font-size: 15px;
    margin-bottom: 12px;
    line-height: 1.6;
}

.group-meta {
    color: var(--text-muted);
    font-size: 13px;
}

.group-meta span {
    margin-right: 18px;
}

.group-slogan {
    color: var(--primary-color);
    font-style: italic;
    font-weight: 500;
}

/* 成员列表 */
.members-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.member-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--bg-body);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
}

.member-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.member-name {
    font-weight: 600;
    color: var(--text-primary);
}

/* 侧边栏小部件 */
.widget {
    background: #fff;
    padding: 24px;
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    transition: all var(--transition-base);
}

.widget:hover {
    box-shadow: var(--shadow-lg);
}

.widget h3 {
    font-size: 17px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--primary-light);
    color: var(--text-primary);
    font-weight: 700;
}

.widget ul {
    list-style: none;
}

.widget li {
    padding: 12px 0;
    border-bottom: 1px dashed var(--border-color);
    transition: all var(--transition-fast);
}

.widget li:hover {
    padding-left: 8px;
}

.widget li:last-child {
    border-bottom: none;
}

.user-info ul {
    margin-top: 16px;
}

.user-info li a {
    display: block;
    padding: 10px 0;
    color: var(--text-secondary);
    font-weight: 500;
    transition: all var(--transition-fast);
}

.user-info li a:hover {
    color: var(--primary-color);
    padding-left: 8px;
}

.resource-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
}

.resource-list li a {
    flex: 1;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.resource-list li a:hover {
    color: var(--primary-color);
}

.resource-list .downloads {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: 12px;
    background: var(--bg-body);
    padding: 4px 8px;
    border-radius: 8px;
    font-weight: 500;
}

.more {
    display: block;
    text-align: right;
    margin-top: 12px;
    font-size: 14px;
    color: var(--primary-color);
    font-weight: 500;
}

.more:hover {
    transform: translateX(-4px);
}

/* 分类标签 */
.categories {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.category-tag {
    display: inline-block;
    padding: 8px 18px;
    background: var(--bg-body);
    border-radius: 20px;
    font-size: 13px;
    text-decoration: none;
    transition: all var(--transition-fast);
    font-weight: 500;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.category-tag:hover {
    background: var(--primary-light);
    color: var(--primary-color);
    border-color: var(--primary-color);
    text-decoration: none;
    transform: translateY(-2px);
}

.category-tag.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, #6366f1 100%);
    color: #fff;
    border-color: transparent;
    box-shadow: var(--shadow-sm);
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.pagination a {
    padding: 10px 20px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 500;
    transition: all var(--transition-fast);
}

.pagination a:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background: var(--primary-light);
    transform: translateY(-1px);
}

.pagination .current {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 14px;
}

/* 页脚 */
.footer {
    background: linear-gradient(135deg, #fff 0%, #f8fafc 100%);
    padding: 48px 0 32px;
    margin-top: 48px;
    text-align: center;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
}

.footer p {
    margin: 8px 0;
    font-size: 14px;
}

.footer a {
    color: var(--text-secondary);
    font-weight: 500;
}

.footer a:hover {
    color: var(--primary-color);
}

/* 空状态 */
.empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 15px;
}

/* 表格样式 */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.admin-table thead {
    background: linear-gradient(135deg, var(--primary-color) 0%, #6366f1 100%);
    color: #fff;
}

.admin-table thead th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.admin-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: all var(--transition-fast);
}

.admin-table tbody tr:hover {
    background: var(--primary-light);
}

.admin-table tbody tr:last-child {
    border-bottom: none;
}

.admin-table tbody td {
    padding: 14px 16px;
    color: var(--text-primary);
    font-size: 14px;
}

.admin-table .btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    margin-right: 6px;
    border-radius: 4px;
}

.admin-table .btn-sm:last-child {
    margin-right: 0;
}

/* 详情页面样式 */
.detail-title {
    font-size: 28px;
    color: var(--text-primary);
    margin-bottom: 20px;
    font-weight: 700;
    line-height: 1.4;
}

.detail-meta {
    color: var(--text-muted);
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--primary-light);
    font-size: 14px;
}

.detail-meta span {
    margin-right: 24px;
}

.detail-content {
    line-height: 1.9;
    color: var(--text-primary);
    margin-bottom: 40px;
    font-size: 15px;
}

/* 回答列表 */
.answer-item {
    padding: 24px 0;
    border-bottom: 1px solid var(--border-color);
    transition: all var(--transition-fast);
}

.answer-item:hover {
    background: var(--primary-light);
    margin: 0 -28px;
    padding-left: 28px;
    padding-right: 28px;
}

.answer-item:last-child {
    border-bottom: none;
}

.answer-header {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
}

.answer-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    margin-right: 12px;
    background: linear-gradient(135deg, var(--primary-color) 0%, #7c3aed 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    box-shadow: var(--shadow-sm);
}

.answer-info {
    flex: 1;
}

.answer-info .name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 15px;
}

.answer-info .time {
    font-size: 13px;
    color: var(--text-muted);
}

.answer-content {
    margin-left: 56px;
    line-height: 1.8;
    color: var(--text-secondary);
}

.tag-best {
    background: linear-gradient(135deg, var(--warning-color) 0%, #d97706 100%);
    color: #fff;
    box-shadow: var(--shadow-sm);
}

/* 资源列表 */
.resource-item {
    display: flex;
    align-items: center;
    padding: 18px 0;
    border-bottom: 1px solid var(--border-color);
    transition: all var(--transition-fast);
}

.resource-item:hover {
    background: var(--primary-light);
    margin: 0 -28px;
    padding-left: 28px;
    padding-right: 28px;
}

.resource-item:last-child {
    border-bottom: none;
}

.resource-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary-color) 0%, #7c3aed 100%);
    color: #fff;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 18px;
    font-size: 22px;
    box-shadow: var(--shadow-sm);
}

.resource-info {
    flex: 1;
}

.resource-title {
    font-size: 16px;
    margin-bottom: 8px;
    font-weight: 600;
}

.resource-title a {
    color: var(--text-primary);
}

.resource-title a:hover {
    color: var(--primary-color);
}

.resource-meta {
    font-size: 13px;
    color: var(--text-muted);
}

.resource-meta span {
    margin-right: 16px;
}

/* 响应式 */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }

    .main-content {
        margin-right: 0;
        padding-top: 20px;
    }

    .sidebar {
        width: 100%;
        float: none;
        margin-top: 20px;
        padding-top: 20px;
    }

    .nav {
        display: none;
    }

    .header .container {
        padding: 12px 16px;
        height: 64px;
    }

    .logo h1 {
        font-size: 22px;
    }

    .logo .tagline {
        display: none;
    }

    .search-section {
        padding: 24px 20px;
    }

    .search-section form {
        flex-direction: column;
    }

    .search-section button {
        width: 100%;
    }

    .section {
        padding: 20px;
    }

    .question-item:hover,
    .answer-item:hover,
    .resource-item:hover,
    .group-item:hover {
        margin: 0;
        padding-left: 20px;
        padding-right: 20px;
    }
}
