/* 文章详情页样式 - 外部CSS文件 */

/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    width: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f8fafc;
    color: #1f2937;
    line-height: 1.6;
    overflow-x: hidden;
}

/* 阅读进度条 */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: #e5e7eb;
    z-index: 1000;
}

.reading-progress-bar {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    width: 0%;
    transition: width 0.3s ease;
}

/* 导航栏 */
.navbar {
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 999;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 48px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 14px;
}

.logo-text {
    font-size: 20px;
    font-weight: bold;
    color: #1f2937;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 32px;
}

.nav-link {
    color: #111827 !important;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
    font-size: 14px;
}

.nav-link:hover {
    color: #667eea;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-btn {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.nav-btn:hover {
    color: #1f2937;
    background: #f3f4f6;
}

.like-btn {
    color: #ef4444;
}

.like-btn.liked {
    color: #ef4444;
}

/* 面包屑导航 */
.breadcrumb {
    background: white;
    padding: 16px 0;
    border-bottom: 1px solid #e5e7eb;
}

.breadcrumb-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.breadcrumb a {
    color: #6b7280;
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb a:hover {
    color: #667eea;
}

.breadcrumb span {
    margin: 0 8px;
    color: #d1d5db;
}

/* 主容器 */
.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 20px;
    width: 100%;
    box-sizing: border-box;
}

.content-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 32px;
}

/* 文章头部 */
.article-header {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    margin-bottom: 32px;
    width: 100%;
    max-width: 100%;
}

.article-hero {
    position: relative;
    height: 320px;
    overflow: hidden;
    width: 100%;
}

.article-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent);
}

.hero-content {
    position: absolute;
    bottom: 24px;
    left: 24px;
    right: 24px;
    color: white;
}

.article-tag {
    display: inline-block;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 16px;
}

.article-title {
    font-size: 28px;
    font-weight: bold;
    line-height: 1.3;
    margin-bottom: 8px;
}

.article-subtitle {
    font-size: 18px;
    opacity: 0.9;
}

/* 文章元信息 */
.article-meta {
    padding: 24px;
    border-bottom: 1px solid #f3f4f6;
}

.meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.author-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
}

.author-details h4 {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 2px;
}

.author-details p {
    font-size: 14px;
    color: #6b7280;
}

.article-stats {
    display: flex;
    align-items: center;
    gap: 24px;
    font-size: 14px;
    color: #6b7280;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* 文章内容 */
.article-content {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    padding: 32px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.content-text {
    font-size: 16px;
    line-height: 1.8;
    color: #374151;
    width: 100%;
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.content-text img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
    margin: 16px auto;
    border-radius: 8px;
}

.content-text p {
    margin-bottom: 16px;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.content-text table {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    display: block;
    white-space: nowrap;
}

.content-text h2 {
    font-size: 24px;
    font-weight: bold;
    color: #1f2937;
    margin: 32px 0 16px 0;
}

.content-text h3 {
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
    margin: 24px 0 12px 0;
}

/* 文章底部互动 */
.article-actions {
    border-top: 1px solid #f3f4f6;
    padding-top: 24px;
    margin-top: 32px;
}

.actions-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.action-buttons {
    display: flex;
    align-items: center;
    gap: 16px;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.like-btn {
    background: #fef2f2;
    color: #ef4444;
}

.like-btn:hover {
    background: #fee2e2;
}

.like-btn.liked {
    background: #fef2f2;
    color: #ef4444;
}

.share-btn {
    background: #f3f4f6;
    color: #6b7280;
}

.share-btn:hover {
    background: #e5e7eb;
}

/* 侧边栏 */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.sidebar-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.mbti-card {
    padding: 24px;
    text-align: center;
}

.mbti-hero {
    width: 100%;
    height: 128px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.mbti-type {
    font-size: 32px;
    font-weight: bold;
    color: white;
}

.mbti-title {
    font-size: 18px;
    font-weight: bold;
    color: #1f2937;
    margin-bottom: 8px;
}

.mbti-desc {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 16px;
    line-height: 1.5;
}

.mbti-btn {
    width: 100%;
    padding: 12px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.mbti-btn:hover {
    opacity: 0.9;
}

/* 推荐文章 */
.recommended-card {
    padding: 24px;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
}

.card-title {
    font-size: 18px;
    font-weight: bold;
    color: #1f2937;
}

.recommended-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.recommended-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.recommended-item:hover {
    background: #f9fafb;
}

.item-image {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.item-content {
    flex: 1;
    min-width: 0;
}

.item-tag {
    display: inline-block;
    padding: 2px 8px;
    background: #f3f4f6;
    color: #6b7280;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 4px;
}

.item-title {
    font-size: 14px;
    font-weight: 500;
    color: #1f2937;
    line-height: 1.4;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #6b7280;
}

/* 热门标签 */
.tags-card {
    padding: 24px;
}

.tags-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-item {
    padding: 6px 12px;
    background: #f3f4f6;
    color: #6b7280;
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tag-item:hover {
    background: #e5e7eb;
    color: #374151;
}

/* 回到顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5);
}

/* 移动端菜单按钮 */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: #1f2937;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
}

/* 移动端菜单弹窗 */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
}

.mobile-menu-popup {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 16px;
    padding: 24px;
    width: 90%;
    max-width: 320px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
}

.mobile-menu-title {
    font-size: 18px;
    font-weight: bold;
    color: #1f2937;
}

.mobile-menu-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
}

.mobile-menu-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-menu-item {
    margin-bottom: 12px;
}

.mobile-menu-link {
    display: block;
    padding: 12px 16px;
    color: #374151;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.mobile-menu-link:hover {
    background: #f3f4f6;
    color: #667eea;
}

/* 分享菜单 */
.share-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
}

.share-menu-popup {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: white;
    border-radius: 16px 16px 0 0;
    padding: 24px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.share-menu-popup.show {
    transform: translateY(0);
}

.share-menu-header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
}

.share-menu-title {
    font-size: 16px;
    font-weight: bold;
    color: #1f2937;
    margin-bottom: 8px;
}

.share-menu-subtitle {
    font-size: 14px;
    color: #6b7280;
}

.share-options {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.share-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: inherit;
}

.share-option:hover {
    background: #f3f4f6;
}

.share-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    font-size: 24px;
    color: white;
}

.share-icon.weixin {
    background: #07c160;
}

.share-icon.weibo {
    background: #ff8200;
}

.share-icon.xiaohongshu {
    background: #ff2442;
}

.share-icon.tieba {
    background: #326ba8;
}

.share-icon.copy {
    background: #6b7280;
}

.share-label {
    font-size: 12px;
    color: #374151;
    text-align: center;
}

.share-cancel {
    width: 100%;
    padding: 12px;
    background: #f3f4f6;
    border: none;
    border-radius: 8px;
    color: #374151;
    font-size: 16px;
    cursor: pointer;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr;
        width: 100%;
    }
}

@media (max-width: 768px) {
    * {
        max-width: 100vw !important;
        box-sizing: border-box;
    }

    img, video, iframe, object, embed {
        max-width: 100% !important;
        height: auto !important;
    }

    pre, code {
        overflow-x: auto;
        white-space: pre-wrap;
        word-wrap: break-word;
    }

    .nav-container {
        flex-wrap: nowrap;
        height: 64px;
        padding: 16px 20px;
    }

    .nav-left {
        gap: 20px;
        width: 100%;
        justify-content: space-between;
    }

    .nav-menu {
        display: none;
    }

    .mobile-menu-btn {
        display: block;
    }

    .nav-link {
        font-size: 13px;
    }

    .main-container {
        padding: 16px;
        width: 100%;
        max-width: 100vw;
    }

    .content-grid {
        width: 100%;
        max-width: 100%;
    }

    .article-header,
    .article-content,
    .sidebar-card {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .article-header {
        margin: 16px;
        border-radius: 12px;
        max-width: calc(100vw - 32px);
    }

    .article-title {
        font-size: 18px;
        line-height: 1.4;
        padding: 0 4px;
        overflow-wrap: break-word;
        word-wrap: break-word;
        hyphens: auto;
    }

    .article-subtitle {
        font-size: 14px;
        padding: 0 4px;
        overflow-wrap: break-word;
        word-wrap: break-word;
    }

    .article-hero {
        height: 200px;
        width: 100%;
    }

    .article-hero img {
        width: 100%;
        height: 200px;
        object-fit: cover;
        object-position: center;
    }

    .hero-content {
        bottom: 12px;
        left: 12px;
        right: 12px;
        padding: 8px;
    }

    .article-tag {
        font-size: 11px;
        padding: 3px 8px;
        margin-bottom: 8px;
        max-width: fit-content;
    }

    .article-content {
        padding: 16px;
        border-radius: 12px;
        margin: 16px;
        max-width: calc(100vw - 32px);
        box-sizing: border-box;
    }

    .content-text {
        font-size: 14px;
        line-height: 1.6;
        overflow-wrap: break-word;
        word-wrap: break-word;
    }

    .content-text img {
        max-width: 100% !important;
        width: 100% !important;
        height: auto !important;
        margin: 12px 0;
    }

    .content-text p {
        margin-bottom: 12px;
        overflow-wrap: break-word;
        word-wrap: break-word;
    }

    .content-text h2 {
        font-size: 20px;
        margin: 24px 0 12px 0;
    }

    .content-text h3 {
        font-size: 18px;
        margin: 20px 0 8px 0;
    }

    .meta-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .article-stats {
        gap: 16px;
        font-size: 13px;
    }

    .actions-row {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

    .action-buttons {
        width: 100%;
        justify-content: center;
    }

    .back-to-top {
        bottom: 16px;
        right: 16px;
        width: 44px;
        height: 44px;
    }

    .sidebar {
        margin: 16px;
        width: calc(100vw - 32px);
    }

    .sidebar-card {
        margin-bottom: 16px;
        max-width: 100%;
    }

    .mbti-card {
        padding: 16px;
    }

    .mbti-hero {
        height: 80px;
        margin-bottom: 12px;
    }

    .mbti-type {
        font-size: 24px;
    }

    .mbti-title {
        font-size: 16px;
        margin-bottom: 6px;
    }

    .mbti-desc {
        font-size: 13px;
        margin-bottom: 12px;
    }

    .recommended-card {
        padding: 16px;
    }

    .card-title {
        font-size: 16px;
    }

    .recommended-item {
        padding: 6px;
        border-radius: 8px;
    }

    .item-image {
        width: 50px;
        height: 50px;
    }

    .item-title {
        font-size: 12px;
        line-height: 1.3;
    }

    .item-meta {
        font-size: 10px;
    }

    .tags-card {
        padding: 16px;
    }

    .tag-item {
        padding: 4px 8px;
        font-size: 11px;
        margin: 2px;
    }

    .share-options {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .share-option:last-child {
        grid-column: 2 / 4;
    }
}

@media (max-width: 480px) {
    .nav-container {
        padding: 12px 16px;
    }

    .nav-left {
        width: 100%;
        justify-content: space-between;
    }

    .logo-text {
        font-size: 18px;
    }

    .nav-menu {
        display: none;
    }

    .mobile-menu-btn {
        display: block;
    }

    .nav-link {
        font-size: 12px;
    }

    .main-container {
        padding: 8px;
        width: 100%;
        max-width: 100vw;
    }

    .article-header {
        margin: 8px;
        max-width: calc(100vw - 16px);
    }

    .article-title {
        font-size: 16px;
        line-height: 1.3;
        padding: 0 6px;
    }

    .article-subtitle {
        font-size: 13px;
        padding: 0 6px;
    }

    .article-hero {
        height: 160px;
    }

    .article-hero img {
        height: 160px;
    }

    .hero-content {
        bottom: 8px;
        left: 8px;
        right: 8px;
        padding: 6px;
    }

    .article-tag {
        font-size: 10px;
        padding: 2px 6px;
    }

    .article-content {
        padding: 12px;
        margin: 8px;
        max-width: calc(100vw - 16px);
    }

    .content-text {
        font-size: 13px;
        line-height: 1.5;
    }

    .content-text img {
        margin: 8px 0;
    }

    .content-text p {
        margin-bottom: 10px;
    }

    .content-text h2 {
        font-size: 16px;
        margin: 16px 0 8px 0;
    }

    .content-text h3 {
        font-size: 15px;
        margin: 12px 0 6px 0;
    }

    .sidebar {
        margin: 8px;
    }

    .sidebar-card {
        margin-bottom: 12px;
        max-width: calc(100vw - 16px);
    }
}

@media (min-width: 769px) {
    .share-menu-popup {
        position: absolute;
        top: 50%;
        left: 50%;
        bottom: auto;
        width: 480px;
        max-width: 90vw;
        border-radius: 16px;
        transform: translate(-50%, -50%) scale(0.9);
        opacity: 0;
        transition: all 0.3s ease;
    }
    
    .share-menu-popup.show {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

/* 图片懒加载优化 */
.lazy-placeholder {
    background: #f3f4f6;
    position: relative;
}

.lazy-placeholder::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    border: 2px solid #d1d5db;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* 性能优化 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 打印样式 */
@media print {
    .navbar,
    .breadcrumb,
    .sidebar,
    .back-to-top,
    .mobile-menu-overlay,
    .share-menu-overlay {
        display: none !important;
    }
    
    .main-container {
        padding: 0;
    }
    
    .article-content {
        box-shadow: none;
        border: 1px solid #e5e7eb;
    }
}
