/* 全局样式 - 与主页统一 */
:root {
    --primary: #2c7be5;
    --primary-dark: #1a68d1;
    --secondary: #6c757d;
    --light: #f8f9fa;
    --dark: #343a40;
    --success: #00d97e;
    --danger: #e63757;
    --warning: #f6c343;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

html, body {
    scroll-behavior: smooth; /* 平滑滚动，与主页一致 */
}

body {
    background-color: #f5f7fa;
    color: var(--dark);
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: var(--primary);
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-outline {
    background-color: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-outline:hover {
    background-color: var(--primary);
    color: white;
}

/* 统一的导航栏样式 - 与主页保持一致 */
header {
    background-color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0; /* 与主页一致的内边距 */
}

.logo {
    display: flex;
    align-items: center;
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

.logo i {
    margin-right: 10px;
    font-size: 28px;
}

.nav-links {
    display: flex;
    list-style: none;
}

.nav-links li {
    margin-left: 25px;
}

.nav-links a {
    color: var(--dark);
    font-weight: 500;
    transition: color 0.3s;
    padding: 5px 0; /* 增加点击区域 */
    position: relative;
}

.nav-links a:hover {
    color: var(--primary);
}

.nav-links a.active {
    color: var(--primary);
    font-weight: 600;
}

/* 增加active状态下划线，与主页统一视觉效果 */
.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--primary);
}

.user-menu {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 10px;
}

.login-actions {
    display: flex;
    gap: 10px;
}

/* 用户信息显示样式 */
.user-info-display {
    display: flex;
    align-items: center;
    gap: 12px;
}

#navUsername {
    font-weight: 500;
    color: var(--dark);
}

/* 用户角色标签样式 - 修改为纵向显示 */
.user-roles {
    display: flex;
    flex-direction: column; /* 改为纵向排列 */
    gap: 2px; /* 减少间距 */
    margin-left: 8px;
}

.role-tag {
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.role-user {
    background-color: #6c757d;
    color: white;
}

.role-contributor {
    background-color: #17a2b8;
    color: white;
}

.role-admin {
    background-color: #dc3545;
    color: white;
}

.role-vip {
    background-color: #ffc107;
    color: #212529;
}


/* 用户名和角色容器 */
.user-name-roles-container {
    display: flex;
    align-items: center;
}

/* 退出按钮样式 */
.logout-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: transparent;
    color: var(--secondary);
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.3s;
}

.logout-btn:hover {
    background-color: #f8f9fa;
    border-color: var(--secondary);
    color: var(--dark);
}

/* 问题库特定样式 */
.page-header {
    background: linear-gradient(135deg, #2c7be5 0%, #1a68d1 100%);
    color: white;
    padding: 60px 0;
}

.page-header h1 {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.page-header p {
    font-size: 1.1rem;
    opacity: 0.9;
    max-width: 600px;
}

.library-content {
    display: flex;
    gap: 30px;
    padding: 40px 0;
}

.filters-sidebar {
    flex: 0 0 280px;
    background-color: white;
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    height: fit-content;
}

.filter-section {
    margin-bottom: 25px;
}

.filter-section h3 {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    font-size: 1.1rem;
}

.filter-options {
    list-style: none;
}

.filter-options li {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}

.filter-options input[type="radio"] {
    margin-right: 10px;
}

.filter-options label {
    cursor: pointer;
    display: flex;
    align-items: center;
    width: 100%;
}

.filter-count {
    margin-left: auto;
    color: var(--secondary);
    font-size: 0.9rem;
}

.problems-main {
    flex: 1;
}

.search-sort-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.search-box {
    flex: 1;
    max-width: 400px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 12px 45px 12px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.search-box button {
    position: absolute;
    right: 5px;
    top: 5px;
    padding: 7px 15px;
    border-radius: 4px;
    background-color: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
}

.sort-options select {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    font-size: 0.9rem;
}

.problems-grid {
    display: grid;
    gap: 20px;
}

.problem-card {
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s, box-shadow 0.3s;
}

.problem-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.problem-content {
    padding: 25px;
}

.problem-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.problem-tag {
    display: inline-block;
    background-color: #e6f2ff;
    color: var(--primary);
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-bottom: 10px;
}

.problem-card h3 {
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.problem-card p {
    color: var(--secondary);
    margin-bottom: 20px;
}

.problem-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    font-size: 0.9rem;
    color: var(--secondary);
}

.rating {
    color: var(--warning);
}

/* 解决方案区域样式 */
.solution-content {
    margin-top: 25px;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}

.solution-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #dee2e6;
}

.solution-header h4 {
    color: var(--primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.solution-meta {
    display: flex;
    gap: 10px;
}

.difficulty-badge, .status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.difficulty-初级 {
    background-color: #d4edda;
    color: #155724;
}

.difficulty-中级 {
    background-color: #fff3cd;
    color: #856404;
}

.difficulty-高级 {
    background-color: #f8d7da;
    color: #721c24;
}

.status-solved {
    background-color: #d1ecf1;
    color: #0c5460;
}

.status-pending {
    background-color: #ffeaa7;
    color: #e17055;
}

.solution-text {
    line-height: 1.8;
    color: var(--dark);
    white-space: pre-line;
}

.solution-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #dee2e6;
}

.rate-solution-btn, .report-issue-btn {
    font-size: 0.9rem;
    padding: 8px 15px;
}

/* 动画效果 */
.solution-content {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 加载状态 */
.loading-solution {
    text-align: center;
    padding: 20px;
    color: var(--secondary);
}

.loading-solution i {
    margin-right: 8px;
}

/* 分页样式优化 - 平滑过渡 */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 40px;
}

.pagination-list {
    display: flex;
    list-style: none;
}

.pagination-item {
    margin: 0 5px;
}

.pagination-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 4px;
    background-color: white;
    color: var(--dark);
    font-weight: 600;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: all 0.3s;
}

.pagination-link:hover, .pagination-link.active {
    background-color: var(--primary);
    color: white;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    padding: 30px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 600;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--secondary);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

.form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
}

.form-but {
    text-align: center;
}

.form-but .btn {
    margin: 0 10px; /* 左右各5px间距 */
}

.form-switch {
    text-align: center;
    margin-top: 15px;
}

.form-switch a {
    color: var(--primary);
    cursor: pointer;
}

.form-switch a:hover {
    text-decoration: underline;
}

/* 页脚 - 与主页统一 */
footer {
    background-color: var(--dark);
    color: white;
    padding: 60px 0 20px;
    margin-top: 60px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-column h3 {
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-links a {
    color: #adb5bd;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: white;
}

.copyright {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #495057;
    color: #adb5bd;
    font-size: 0.9rem;
}

/* 响应式设计 - 与主页统一断点 */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        padding: 15px 0;
    }

    .nav-links {
        margin-top: 15px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .nav-links li {
        margin: 0 10px;
    }

    .library-content {
        flex-direction: column;
    }

    .filters-sidebar {
        flex: none;
    }

    .search-sort-bar {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }

    .search-box {
        max-width: 100%;
    }

    .user-info-display {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }

    .logout-btn {
        margin-top: 5px;
    }

    .solution-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .solution-actions {
        flex-direction: column;
    }

    .solution-meta {
        width: 100%;
        justify-content: flex-start;
    }

    .user-name-roles-container {
        flex-direction: column;
        align-items: center;
    }

    .user-roles {
        margin-left: 0;
        margin-top: 5px;
    }
}