/**
 * 弹窗文章详情样式
 */

/* ========== 弹窗容器调整 ========== */
.ri-popup .ri-popup-body {
    max-width: 90vw;
    max-height: 90vh;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ========== 弹窗顶部导航栏 ========== */
.popup-article-nav {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
    gap: 10px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.popup-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #f8f9fa;
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    flex-shrink: 0;
}

.popup-nav-btn:hover {
    background: #e9ecef;
    color: #2163e8;
    border-color: #2163e8;
}

.popup-nav-info {
    flex: 1;
    min-width: 0;
}

.popup-nav-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

/* 弹窗内容主体 - 可滚动 */
.popup-article-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* ========== 文章详情区域 ========== */
.popup-article-detail {
    opacity: 1;
    transform: translateY(0);
}

/* 文章头部 */
.popup-article-header {
    padding: 24px 24px 16px;
}

.popup-article-title {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.4;
    margin: 0 0 12px;
    color: #1a1a1a;
}

.popup-article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 0.85rem;
    color: #888;
}

.popup-article-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.popup-article-meta a {
    color: #888;
    text-decoration: none;
}

.popup-article-meta a:hover {
    color: #2163e8;
}

/* ========== 购买面板 ========== */
.popup-shop-panel {
    margin: 0 24px 16px;
    padding: 0;
}

.popup-shop-panel .shop-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #eee;
}

.popup-shop-panel .shop-row-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.popup-shop-panel .shop-row-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.popup-shop-panel .shop-row-icon.success {
    background: rgba(25,135,84,.1);
    color: #198754;
}

.popup-shop-panel .shop-row-icon.info {
    background: rgba(13,110,253,.1);
    color: #0d6efd;
}

.popup-shop-panel .shop-row-icon.warning {
    background: rgba(255,152,0,.1);
    color: #e67e00;
}

.popup-shop-panel .shop-row-text {
    font-size: 0.875rem;
    color: #555;
    font-weight: 500;
}

.popup-shop-panel .shop-row-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.popup-shop-panel .shop-btn {
    display: inline-flex;
    align-items: center;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.popup-shop-panel .shop-btn-success {
    background: linear-gradient(135deg, #198754, #157347);
    color: #fff;
}

.popup-shop-panel .shop-btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(25,135,84,.3);
}

.popup-shop-panel .shop-btn-danger {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: #fff;
}

.popup-shop-panel .shop-btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220,53,69,.3);
}

.popup-shop-panel .shop-btn-primary {
    background: linear-gradient(135deg, #2163e8, #1a5276);
    color: #fff;
}

.popup-shop-panel .shop-pwd-btn {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 0.75rem;
    color: #495057;
    cursor: pointer;
    font-family: 'SF Mono', 'Fira Code', monospace;
}

.popup-shop-panel .shop-pwd-btn:hover {
    background: #e9ecef;
}

/* ========== 文章内容 ========== */
.popup-article-content {
    padding: 0 24px 24px;
    font-size: 15px;
    line-height: 1.8;
    color: #333;
}

.popup-article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.popup-article-content pre {
    border-radius: 8px;
}

.popup-article-content blockquote {
    border-left: 4px solid #2163e8;
    padding: 12px 16px;
    background: #f0f4ff;
    border-radius: 0 8px 8px 0;
    margin: 16px 0;
}

/* ========== 相关文章 ========== */
.popup-related-posts {
    padding: 20px 24px 24px;
    border-top: 1px solid #eee;
}

.popup-related-posts .related-posts-title {
    display: flex;
    align-items: center;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: #333;
}

/* 相关文章卡片 */
.popup-related-item {
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    border: 1px solid #f0f0f0;
    transition: all 0.25s ease;
    cursor: pointer;
}

.popup-related-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,.08);
    border-color: #2163e8;
}

.popup-related-item .entry-media {
    border-radius: 0;
    overflow: hidden;
}

.popup-related-item .entry-media .media-img {
    background-size: cover;
    background-position: center;
    transition: transform 0.3s ease;
}

.popup-related-item:hover .entry-media .media-img {
    transform: scale(1.05);
}

.popup-related-item .entry-wrapper {
    padding: 10px 12px;
}

.popup-related-item .entry-title {
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0 0 6px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.popup-related-item .entry-title a {
    color: #333;
    text-decoration: none;
}

.popup-related-item:hover .entry-title a {
    color: #2163e8;
}

.popup-related-item .entry-meta {
    display: flex;
    gap: 12px;
    font-size: 0.75rem;
    color: #aaa;
}

.popup-related-item .entry-meta span {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

/* ========== 加载动画 ========== */
.popup-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    min-height: 200px;
}

.popup-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f0f0f0;
    border-top-color: #2163e8;
    border-radius: 50%;
    animation: popupSpin 0.8s linear infinite;
}

@keyframes popupSpin {
    to { transform: rotate(360deg); }
}

.popup-loading-text {
    margin-top: 16px;
    font-size: 0.9rem;
    color: #888;
}

/* ========== 暗色主题适配 ========== */
[data-bs-theme=dark] .popup-article-nav {
    background: #1e2024;
    border-color: #333;
}

[data-bs-theme=dark] .popup-nav-title {
    color: #e0e0e0;
}

[data-bs-theme=dark] .popup-nav-btn {
    background: #2a2d31;
    border-color: #444;
    color: #ccc;
}

[data-bs-theme=dark] .popup-nav-btn:hover {
    background: #333;
    color: #7fa4f1;
}

[data-bs-theme=dark] .popup-article-title {
    color: #e0e0e0;
}

[data-bs-theme=dark] .popup-shop-panel .shop-row {
    background: #2a2d31;
    border-color: #444;
}

[data-bs-theme=dark] .popup-shop-panel .shop-row-text {
    color: #ccc;
}

[data-bs-theme=dark] .popup-shop-panel .shop-pwd-btn {
    background: #2a2d31;
    border-color: #444;
    color: #ccc;
}

[data-bs-theme=dark] .popup-article-content {
    color: #ccc;
}

[data-bs-theme=dark] .popup-related-posts {
    border-color: #333;
}

[data-bs-theme=dark] .popup-related-posts .related-posts-title {
    color: #e0e0e0;
}

[data-bs-theme=dark] .popup-related-item {
    background: #1e2024;
    border-color: #333;
}

[data-bs-theme=dark] .popup-related-item .entry-title a {
    color: #ddd;
}

[data-bs-theme=dark] .popup-related-item:hover .entry-title a {
    color: #7fa4f1;
}

/* ========== 响应式 ========== */
@media (max-width: 767.98px) {
    .ri-popup .ri-popup-body {
        max-width: 100vw;
        max-height: 100vh;
        width: 100vw !important;
        border-radius: 0;
    }
    
    .popup-article-header {
        padding: 16px;
    }
    
    .popup-article-title {
        font-size: 1.25rem;
    }
    
    .popup-article-meta {
        gap: 10px;
        font-size: 0.8rem;
    }
    
    .popup-shop-panel {
        margin: 0 16px 12px;
    }
    
    .popup-shop-panel .shop-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .popup-shop-panel .shop-row-right {
        justify-content: center;
    }
    
    .popup-article-content {
        padding: 0 16px 16px;
        font-size: 14px;
    }
    
    .popup-related-posts {
        padding: 16px;
    }
    
    .popup-related-item .entry-wrapper {
        padding: 8px;
    }
    
    .popup-related-item .entry-title {
        font-size: 0.8rem;
    }
}
