/* =============================================================================== */
/* 资源详情页个性化样式 */
/* 基于 mainstyle.css 和 mainvariables.css 的设计系统 */
/* =============================================================================== */

/* ============= 主内容区域 ============= */
.material-detail-article {
    background: var(--bg-color-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color-default);
    transition: box-shadow var(--transition-base);
    will-change: box-shadow;
}

.material-detail-article:hover {
    box-shadow: var(--shadow-md);
}

/* ============= 资料标题区域 ============= */
.material-header {
    border-bottom: 1px solid var(--border-color-default);
    padding-bottom: var(--space-4);
    margin-bottom: var(--space-5);
}

.material-header h1 {
    text-align: center;
    color: var(--text-color-secondary);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-title);
    margin-bottom: var(--space-3);
}

.material-meta {
    display: inline-flex;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.material-meta-item {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    color: var(--text-color-tertiary);
    font-size: var(--text-sm);
}

.material-meta-item i {
    color: var(--primary-600);
    font-size: var(--text-base);
}

.material-meta-item a {
    color: var(--primary-600);
    text-decoration: none;
    transition: color var(--transition-base);
}

.material-meta-item a:hover {
    color: var(--primary-700);
    text-decoration: underline;
}

/* ============= 资料详情区域 ============= */
.material-description {
    margin-bottom: var(--space-6);
}

.title-with-lines {
    position: relative;
    text-align: center;
    margin-bottom: var(--space-4);
    color: var(--text-color-secondary);
    font-weight: var(--font-weight-semibold);
    background-color: var(--bg-color-secondary);
    border-radius: var(--radius-base);
    padding: var(--space-2) var(--space-3);
}

.title-with-lines i {
    color: var(--text-color-secondary);
}

.title-with-lines span {
    padding: 0 var(--space-3);
    position: relative;
    z-index: var(--z-index-base);
}

.content-container {
    background: var(--neutral-50);
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color-light);
}

.content-container p {
    margin-bottom: var(--space-3);
    color: var(--text-color-secondary);
    line-height: var(--line-height-relaxed);
}

.content-container ul {
    margin: var(--space-3) 0;
    padding-left: var(--space-4);
}

.content-container ul li {
    margin-bottom: var(--space-2);
    color: var(--text-color-secondary);
}

/* ============= 文件信息与下载区域 ============= */
.material-file-info {
    margin-bottom: var(--space-6);
}

.file-info-card {
    background: var(--neutral-50);
    border: 1px solid var(--border-color-light);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    text-align: center;
}

.file-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.file-info i {
    font-size: var(--text-xl);
    color: var(--error-600);
}

.file-info h6 {
    color: var(--text-color-primary);
    font-weight: var(--font-weight-semibold);
    margin: 0;
}

.file-info .card-text {
    color: var(--text-color-tertiary);
    font-size: var(--text-sm);
    margin: var(--space-2) 0;
}

/* ============= 下载按钮样式 ============= */
.download-btn {
    background: var(--primary-600);
    border: none;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-lg);
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    transition: all var(--transition-base);
    cursor: pointer;
    will-change: transform, box-shadow;
}

.download-btn span {
    color: var(--white) !important;
    font-size: var(--text-sm);
    font-weight: var(--font-weight-medium);
    text-decoration: none;
}

.download-btn i {
    color: var(--white) !important;
    font-size: var(--text-base);
}

.download-btn:hover {
    background: var(--primary-700);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    color: var(--white);
    text-decoration: none;
}

.download-btn:focus {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

.download-btn:disabled,
.download-btn.disabled {
    background: var(--neutral-400);
    color: var(--white);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.download-btn.disabled:hover {
    background: var(--neutral-400);
    transform: none;
    box-shadow: none;
}

/* ============= 登录提示 ============= */
.login-prompt {
    text-align: center;
    margin-top: var(--space-3);
    color: var(--text-color-tertiary);
    font-size: var(--text-sm);
}

.login-prompt a {
    color: var(--primary-600);
    text-decoration: none;
    font-weight: var(--font-weight-medium);
}

.login-prompt a:hover {
    color: var(--primary-700);
    text-decoration: underline;
}

/* ============= 评论区域 ============= */
.material-comments {
    margin-bottom: var(--space-6);
}

.comment-list {
    margin-bottom: var(--space-5);
}

.comment-item {
    background: var(--neutral-50);
    border: 1px solid var(--border-color-light);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-bottom: var(--space-3);
    transition: box-shadow var(--transition-base);
}

.comment-item:hover {
    border-color: var(--border-color-medium);
    box-shadow: var(--shadow-sm);
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-2);
}

.comment-author {
    font-weight: var(--font-weight-semibold);
    color: var(--text-color-secondary);
    font-size: var(--text-sm);
}

.comment-date {
    color: var(--text-color-tertiary);
    font-size: var(--text-sm);
}

.comment-content p {
    color: var(--text-color-secondary);
    margin: 0;
    line-height: var(--line-height-relaxed);
}

.add-comment {
    margin-top: var(--space-5);
}

.add-comment h5 {
    color: var(--text-color-primary);
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--space-3);
}

.comment-form {
    background: var(--bg-color-secondary);
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color-default);
}

.comment-form .form-group {
    margin-bottom: var(--space-3);
}

.comment-form textarea {
    width: 100%;
    border: 1px solid var(--border-color-default);
    border-radius: var(--radius-base);
    padding: var(--space-3);
    font-size: var(--text-base);
    background: var(--bg-color-primary);
    color: var(--text-color-primary);
    transition: border-color var(--transition-base);
    resize: vertical;
    min-height: 80px;
}

.comment-form textarea:focus {
    border-color: var(--primary-500);
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-100);
}

.comment-form textarea::placeholder {
    color: var(--text-color-tertiary);
}

.comment-form textarea:disabled {
    background: var(--bg-color-disabled);
    color: var(--text-color-disabled);
    cursor: not-allowed;
}

.comment-submit-btn {
    background: var(--primary-600);
    color: var(--white);
    border: none;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-base);
    font-size: var(--text-sm);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: all var(--transition-base);
}

.comment-submit-btn:hover {
    background: var(--primary-700);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.comment-submit-btn:disabled {
    background: var(--neutral-400);
    color: var(--white);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.comment-login-prompt {
    text-align: center;
    padding: var(--space-4);
    color: var(--text-color-tertiary);
    background: var(--bg-color-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color-default);
}

.comment-login-prompt a {
    color: var(--primary-600);
    text-decoration: none;
    font-weight: var(--font-weight-medium);
}

.comment-login-prompt a:hover {
    color: var(--primary-700);
    text-decoration: underline;
}

/* ============= 侧边栏 ============= */
.author-info,
.related-info,
.tag-cloud,
.related-materials-list {
    background: var(--bg-color-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color-default);
    transition: box-shadow var(--transition-base);
}

.sidebar-header {
    background: var(--bg-color-secondary);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-base);
    margin-bottom: var(--space-3);
}

.sidebar-header h4 {
    color: var(--text-color-primary);
    font-weight: var(--font-weight-semibold);
    margin: 0;
    font-size: var(--text-base);
}

.sidebar-header i {
    color: var(--primary-600);
    font-size: var(--text-base);
    margin-right: var(--space-2);
}

.related-materials-subheader {
    color: var(--text-color-primary);
    font-weight: var(--font-weight-semibold);
    font-size: var(--text-sm);
    margin-bottom: var(--space-2);
    position: relative;
    text-align: center;
}

.related-materials-subheader::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 2px;
    background: var(--primary-600);
    border-radius: var(--radius-full);
}

.related-materials-subheader::before {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 2px;
    background: var(--primary-600);
    border-radius: var(--radius-full);
}

.sidebar-list-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.sidebar-list-group a {
    display: block;
    padding: var(--space-2) var(--space-3);
    color: var(--text-color-primary);
    text-decoration: none;
    border-radius: var(--radius-base);
    transition: all var(--transition-base);
    font-size: var(--text-sm);
    line-height: var(--line-height-title);
}

.sidebar-list-group a:hover {
    background: var(--primary-50);
    color: var(--primary-700);
    transform: translateX(2px);
}

.sidebar-group-item span {
    display: block;
    color: var(--text-color-primary);
    font-size: var(--text-sm);
    line-height: var(--line-height-title);
    text-decoration: none;
}

.sidebar-group-item {
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-base);
    transition: all var(--transition-base);
    border: 1px solid transparent;
}

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

.sidebar-group-item.active {
    background: var(--primary-600);
    color: var(--white);
    border-color: var(--primary-600);
}

.related-info {
    padding: var(--space-5);
}

.related-info:hover {
    box-shadow: var(--shadow-md);
}

.related-info .related-info {
    margin-bottom: var(--space-2);
}

.related-info .related-info div {
    margin-bottom: var(--space-1);
    font-size: var(--text-sm);
}

.related-info .related-info span {
    font-weight: var(--font-weight-medium);
    color: var(--text-color-primary);
}

.related-info .related-info a {
    color: var(--primary-600);
    text-decoration: none;
    transition: color var(--transition-base);
}

.related-info .related-info a:hover {
    color: var(--primary-700);
    text-decoration: underline;
}

.author-info {
    margin-bottom: var(--space-6);
}

.author-info img {
    width: 80px;
    height: 80px;
    place-self: center;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 3px solid var(--primary-200);
    margin-bottom: var(--space-2);
}

.author-info h6 {
    color: var(--text-color-primary);
    font-weight: var(--font-weight-semibold);
    margin: 0;
    text-align: center;
}

.author-content {
    text-align: center;
    padding: var(--space-3);
}

.tag-cloud {
    margin-bottom: var(--space-4);
}

.tag-cloud-container {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.tag-cloud-item {
    display: inline-block;
    background: var(--primary-50);
    color: var(--primary-600);
    border-radius: var(--radius-full);
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
    text-decoration: none;
    transition: all var(--transition-base);
}

.tag-cloud-item:hover {
    background: var(--primary-600);
    color: var(--white);
    transform: translateY(-1px);
}

.related-materials-list {
    margin-bottom: var(--space-4);
}

.related-materials-list .list-group-item {
    border: 1px solid var(--border-color-default);
    border-radius: var(--radius-base);
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-1);
    transition: all var(--transition-base);
    background: var(--bg-color-primary);
}

.related-materials-list .list-group-item:hover {
    background: var(--primary-50);
    border-color: var(--primary-300);
}

.related-materials-list .list-group-item:last-child {
    margin-bottom: 0;
}

.related-materials-list .list-group-item.active {
    background: var(--primary-600);
    color: var(--white);
    border-color: var(--primary-600);
}

/* ============= 响应式设计 ============= */
@media (max-width: 767px) {
    .website-container {
        padding: var(--space-4) 0;
    }

    .material-header h1 {
        font-size: var(--text-xl);
    }

    .material-meta-item {
        font-size: var(--text-xs);
    }

    .file-info-card {
        padding: var(--space-4);
    }

    .comment-item {
        padding: var(--space-3);
    }

    .add-comment {
        margin-top: var(--space-4);
    }
}

@media (max-width: 479px) {
    .material-header {
        padding-bottom: var(--space-3);
        margin-bottom: var(--space-4);
    }

    .title-with-lines::before,
    .title-with-lines::after {
        display: none;
    }

    .content-container {
        padding: var(--space-3);
    }

    .file-info-card {
        padding: var(--space-3);
    }

    .download-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ============= 可访问性增强 ============= */
@media (prefers-reduced-motion: reduce) {
    .material-detail-article,
    .download-btn,
    .comment-item,
    .sidebar-list-group a,
    .tag-cloud-item {
        transition: none;
        transform: none;
    }

    .download-btn:hover,
    .sidebar-list-group a:hover,
    .tag-cloud-item:hover {
        transform: none;
    }
}

/* ============= 高对比度模式支持 ============= */
@media (prefers-contrast: high) {
    .material-detail-article,
    .author-info,
    .related-info,
    .tag-cloud,
    .related-materials-list {
        border-width: 2px;
    }

    .download-btn {
        border-width: 2px;
    }
}

/* ============= 打印样式优化 ============= */
@media print {
    .download-btn,
    .comment-submit-btn {
        display: none;
    }

    .material-detail-article {
        box-shadow: none;
        border: 1px solid var(--neutral-300);
    }
}