/* === 156 博客 - 链接页独立样式（完整版，含暗色适配） === */

/* ---------- 亮色模式（默认） ---------- */
.link-page {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
    display: flex;
    gap: 30px;
    position: relative;
}

/* 侧边目录 (PC端) */
.link-page .sidebar {
    flex: 0 0 200px;
    position: sticky;
    top: 20px;
    height: fit-content;
    background: #fff;
    border-radius: 12px;
    padding: 20px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}
.link-page .sidebar h3 {
    padding: 0 20px;
    margin-bottom: 15px;
    font-size: 16px;
    color: #555;
    border-left: 3px solid #10B981; /* 苦力怕绿 */
    padding-left: 15px;
}
.link-page .sidebar a {
    display: block;
    padding: 12px 20px;
    transition: 0.2s;
    border-left: 3px solid transparent;
    color: #333;
    text-decoration: none;
}
.link-page .sidebar a:hover,
.link-page .sidebar a.active {
    background: #f0fdf4;
    border-left-color: #10B981;
    color: #10B981;
}

/* 右侧内容 */
.link-page .main-content {
    flex: 1;
    min-width: 0;
}
.link-page .section {
    background: #fff;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    scroll-margin-top: 20px;
}
.link-page .section-title {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 15px;
}

.link-page .github-cta {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.link-page .github-cta p {
    margin: 0;
    color: #666;
    line-height: 1.7;
}
.link-page .github-cta-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    padding: 10px 18px;
    border-radius: 999px;
    background: linear-gradient(135deg, #10B981, #34D399);
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.18);
}
.link-page .github-cta-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(16, 185, 129, 0.22);
}

/* 卡片网格 */
.link-page .card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}
.link-page .link-card {
    border: 1px solid #f0f0f0;
    border-radius: 10px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s;
    background: #fff;
    text-decoration: none;
    color: inherit;
}
.link-page .link-card:hover {
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.1);
    border-color: #10B981;
}
.link-page .link-card.add-friend-card {
    cursor: pointer;
    border-style: dashed;
    border-color: #a7f3d0;
    background: linear-gradient(135deg, #f0fdf4, #ffffff);
}
.link-page .link-card.add-friend-card:hover {
    border-color: #10B981;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.12);
}
.link-page .link-card .card-foot {
    margin-top: 12px;
    color: #10B981;
    font-size: 14px;
    font-weight: 600;
}
.link-page .link-card .info h4 {
    font-size: 16px;
    margin-bottom: 6px;
    color: #333;
}
.link-page .link-card .info p {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
    margin: 0;
}
.link-page .link-card .card-btn {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 13px;
    border: 1px solid #e5e7eb;
    text-decoration: none;
    margin-right: 8px;
    margin-top: 12px;
}
.link-page .link-card .card-btn.primary {
    border-color: #10B981;
    color: #10B981;
}
.link-page .link-card .card-btn.primary:hover {
    background: #10B981;
    color: #fff;
}

.friend-link-toast {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}
.friend-link-toast.show {
    opacity: 1;
    visibility: visible;
}
.friend-toast-box {
    width: min(420px, calc(100vw - 32px));
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.15);
    padding: 22px 20px 18px;
    border: 1px solid #f0f0f0;
}
.friend-toast-header {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 16px;
    color: #1f2937;
}
.friend-toast-content {
    font-size: 15px;
    line-height: 1.9;
    color: #4b5563;
    padding: 12px 14px;
    background: #f9fafb;
    border-radius: 10px;
    margin-bottom: 18px;
}
.friend-toast-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}
.toast-btn {
    border: none;
    border-radius: 999px;
    padding: 9px 16px;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease;
}
.toast-btn:hover {
    transform: translateY(-1px);
}
.toast-btn.secondary {
    background: #f3f4f6;
    color: #374151;
}
.toast-btn.primary {
    background: linear-gradient(135deg, #10B981, #34D399);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* 移动端顶部横向目录 */
.link-page .mobile-catalog {
    display: none;
    overflow-x: auto;
    white-space: nowrap;
    padding: 0 0 15px 0;
    gap: 10px;
    -webkit-overflow-scrolling: touch;
}
.link-page .mobile-catalog::-webkit-scrollbar {
    display: none;
}
.link-page .mobile-catalog a {
    display: inline-block;
    padding: 8px 16px;
    background: #fff;
    border-radius: 20px;
    font-size: 14px;
    color: #333;
    text-decoration: none;
    margin-right: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.link-page .mobile-catalog a:active {
    background: #10B981;
    color: #fff;
}

/* 移动端响应式 */
@media (max-width: 768px) {
    .link-page {
        flex-direction: column;
        padding: 0 15px;
        margin: 20px auto;
    }
    .link-page .sidebar {
        display: none;
    }
    .link-page .mobile-catalog {
        display: flex;
        align-items: center;
    }
    .link-page .card-grid {
        grid-template-columns: 1fr;
    }
}

/* ---------- 暗色模式（html[data-theme="dark"]） ---------- */
html[data-theme="dark"] .link-page .sidebar,
html[data-theme="dark"] .link-page .section,
html[data-theme="dark"] .link-page .link-card,
html[data-theme="dark"] .link-page .mobile-catalog a {
    background: #2a2a2a; /* 柔和深灰，不压抑 */
}

html[data-theme="dark"] .link-page .sidebar {
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

html[data-theme="dark"] .link-page .sidebar h3 {
    color: #ccc;
    border-left-color: #10B981; /* 绿色不变 */
}

html[data-theme="dark"] .link-page .sidebar a {
    color: #ddd;
}
html[data-theme="dark"] .link-page .sidebar a:hover,
html[data-theme="dark"] .link-page .sidebar a.active {
    background: #3a3a3a;
    border-left-color: #10B981;
    color: #10B981; /* 保持绿色高亮 */
}

/* 主内容文字颜色 */
html[data-theme="dark"] .link-page .main-content,
html[data-theme="dark"] .link-page .section-title,
html[data-theme="dark"] .link-page .link-card .info h4 {
    color: #fff;
}

html[data-theme="dark"] .link-page .section {
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

html[data-theme="dark"] .link-page .section-title {
    border-bottom-color: #444;
}

html[data-theme="dark"] .link-page .github-cta p {
    color: #aaa;
}

html[data-theme="dark"] .link-page .link-card {
    border-color: #3a3a3a;
}
html[data-theme="dark"] .link-page .link-card:hover {
    border-color: #10B981;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

html[data-theme="dark"] .link-page .link-card .info p {
    color: #aaa; /* 辅助描述文字柔和 */
}

html[data-theme="dark"] .link-page .link-card .card-btn {
    border-color: #555;
    color: #ccc;
}
html[data-theme="dark"] .link-page .link-card .card-btn.primary {
    border-color: #10B981;
    color: #10B981;
}
html[data-theme="dark"] .link-page .link-card .card-btn.primary:hover {
    background: #10B981;
    color: #fff;
}

html[data-theme="dark"] .friend-toast-box {
    background: #2a2a2a;
    border-color: #3a3a3a;
}
html[data-theme="dark"] .friend-toast-header {
    color: #fff;
}
html[data-theme="dark"] .friend-toast-content {
    background: #1f1f1f;
    color: #d1d5db;
}
html[data-theme="dark"] .toast-btn.secondary {
    background: #3a3a3a;
    color: #e5e7eb;
}

html[data-theme="dark"] .link-page .mobile-catalog a {
    color: #ddd;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
html[data-theme="dark"] .link-page .mobile-catalog a:active {
    background: #10B981;
    color: #fff;
}
