/**
 * Typecho-Eight-Theme - 主题样式
 * 一款Typecho图文博客主题
 * 
 * @author RAO
 * @version 1.3.0
 * @link https://qi.loc.cc/
 */

/* ========================================
   1. 全局基础样式
   ======================================== */

:root {
    --theme-primary: #43cea2;
    --theme-primary-dark: #2bb8c4;
    --theme-gradient: linear-gradient(135deg, #43cea2 0%, #3cbdb1 50%, #2bb8c4 100%);
    --theme-text: #333333;
    --theme-text-light: #888888;
    --theme-bg: #ffffff;
    --theme-bg-light: #f8f9fa;
    --theme-border: #e9ecef;
    --theme-green: #4cd964;
    --theme-link: #43cea2;
    --theme-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --theme-radius: 6px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
    color: var(--theme-text);
    background-color: var(--theme-bg);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: #7a7a7a;
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--theme-link);
    text-decoration: none;
}

img {
    max-width: 100%;
    height: auto;
}

/* ========================================
   2. 导航栏
   ======================================== */

.navbar {
    padding: 0.75rem 0;
    background-color: var(--theme-bg) !important;
    z-index: 1030;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--theme-text) !important;
    letter-spacing: -0.5px;
}

.navbar-nav .nav-link {
    color: var(--theme-text) !important;
    font-size: 0.925rem;
    padding: 0.5rem 1rem !important;
    transition: color 0.2s ease;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-item.active .nav-link {
    color: var(--theme-primary) !important;
}

.navbar-nav .nav-item .fa-user {
    font-size: 1rem;
    color: var(--theme-text);
}

.navbar-nav .nav-item:hover .fa-user {
    color: var(--theme-primary);
}

/* ========================================
   3. Banner 区域
   ======================================== */

.banner-section {
    padding: 3rem 0 3.5rem;
    background: var(--theme-gradient);
    position: relative;
}

.banner-title {
    font-size: 2rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.5rem;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.banner-desc {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0;
}

/* 搜索框 */
.search-box {
    max-width: 560px;
    margin-top: 1.5rem;
}

.search-input {
    border: none;
    border-radius: 50px 0 0 50px !important;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    height: auto;
}

.search-input:focus {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    outline: none;
    border-color: transparent;
}

.btn-search {
    background: #ffffff;
    border: none;
    border-radius: 0 50px 50px 0 !important;
    padding: 0.75rem 1.5rem;
    color: var(--theme-primary);
    font-size: 1.1rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: color 0.2s ease;
}

.btn-search:hover {
    color: var(--theme-primary-dark);
}

/* ========================================
   4. 主内容区域
   ======================================== */

.main-content {
    flex: 1;
    padding: 2rem 0;
}

/* ========================================
   5. 首页 - 文章卡片网格
   ======================================== */

.post-grid {
    padding-top: 0.5rem;
}

.post-card {
    border-radius: var(--theme-radius);
    overflow: hidden;
    box-shadow: var(--theme-shadow);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    background: var(--theme-bg);
    height: 100%;
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.post-card-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.post-card-link:hover {
    color: inherit;
    text-decoration: none;
}

.post-card-thumb {
    position: relative;
    overflow: hidden;
    padding-top: 66.67%; /* 3:2 宽高比 */
}

.post-card-thumb img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.post-card:hover .post-card-thumb img {
    transform: scale(1.05);
}

.post-card-category {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: rgba(0, 0, 0, 0.5);
    color: #ffffff;
    font-size: 0.75rem;
    padding: 0.25rem 0.65rem;
    border-radius: 3px;
    z-index: 10;
    line-height: 1.4;
    pointer-events: none;
}

.post-card-category a {
    color: #ffffff;
    text-decoration: none;
}

.post-card-body {
    padding: 1rem;
}

.post-card-title {
    font-size: 0.95rem;
    font-weight: 400;
    color: var(--theme-text);
    margin: 0;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========================================
   6. 分页导航
   ======================================== */

/* --- Pagination --- */
.eight-pagination {
    padding: 2rem 0 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.eight-pagination .page-navigator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.eight-pagination .page-navigator li {
    display: inline-flex;
}

.eight-pagination .page-navigator li a,
.eight-pagination .page-navigator li span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 13px;
    color: var(--theme-text-light);
    background: var(--theme-bg);
    text-decoration: none;
    transition: all 0.2s ease;
    line-height: 1;
}

.eight-pagination .page-navigator li a:hover {
    color: var(--theme-bg);
    background: #c6c6c6;
}

.eight-pagination .page-navigator li.current a,
.eight-pagination .page-navigator li.current span {
    color: var(--theme-bg);
    background: #43cea2;
    font-weight: 500;
}

/* prev / next text links fallback */
.eight-pagination > a,
.eight-pagination > span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 13px;
    color: var(--theme-text-light);
    background: var(--theme-bg);
    text-decoration: none;
    transition: all 0.2s ease;
}

.eight-pagination > a:hover {
    color: var(--theme-bg);
    background: var(--theme-text-light);
}

/* 无结果 */
.no-results {
    text-align: center;
    padding: 2rem;
    color: var(--theme-text-light);
}

/* ========================================
   7. 文章详情页
   ======================================== */

.post-single {
    max-width: 100%;
    margin: 0 auto;
}

.post-header {
    margin-bottom: 1.5rem;
}

.post-title {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.4;
}

.post-title a {
    color: var(--theme-primary);
}

.post-title a:hover {
    color: var(--theme-primary-dark);
}

.post-meta {
    font-size: 0.85rem;
    margin-top: 0.75rem;
}

.post-meta span {
    margin: 0 0.3rem;
}

.post-meta i {
    margin-right: 3px;
}

/* 文章内容样式 */
.post-content {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--theme-text);
}

.post-content p {
    margin-bottom: 1.2rem;
}

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--theme-radius);
    margin: 1rem auto;
    display: block;
}

.post-content h2,
.post-content h3,
.post-content h4 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.post-content blockquote {
    border-left: 4px solid var(--theme-primary);
    padding: 0.75rem 1.25rem;
    margin: 1rem 0;
    background: var(--theme-bg-light);
    border-radius: 0 var(--theme-radius) var(--theme-radius) 0;
    color: #555;
}

.post-content pre {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 1rem 1.25rem;
    border-radius: var(--theme-radius);
    overflow-x: auto;
    font-size: 0.875rem;
    line-height: 1.6;
    margin: 1rem 0;
}

.post-content code {
    background: var(--theme-bg-light);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.875rem;
    color: #e74c3c;
}

.post-content pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

.post-content table {
    width: 100%;
    margin: 1rem 0;
    border-collapse: collapse;
}

.post-content table th,
.post-content table td {
    border: 1px solid var(--theme-border);
    padding: 0.5rem 0.75rem;
    text-align: left;
}

.post-content table th {
    background: var(--theme-bg-light);
    font-weight: 600;
}

/* 点赞和打赏 */
.post-actions {
    padding: 2rem 0;
}

.btn-action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 55px;
    height: 55px;
    border-radius: 50%;
    border: 2px solid #e8e8e8;
    background: #f9f9f9;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    outline: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.btn-action:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.btn-action:active {
    transform: scale(0.95);
}

.btn-like {
    color: #ff1493;
}

.btn-like svg {
    transition: all 0.3s ease;
}

.btn-like:hover svg,
.btn-like.liked svg {
    stroke: #ff1493;
    fill: rgba(255, 20, 147, 0.1);
}

.btn-like .like-count {
    font-size: 0.8rem;
    font-weight: 700;
    color: #ff1493;
    position: absolute;
    top: 2px;
    right: -2px;
    line-height: 1;
}

.btn-reward {
    color: #00c853;
}

.btn-reward:hover {
    border-color: #00c853;
}

.reward-text {
    font-size: 1.5rem;
    font-weight: 900;
    color: #00c853;
    line-height: 1;
}

/* 打赏弹窗 */
#rewardModal .modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
}

#rewardModal .modal-header .close {
    position: absolute;
    right: 1rem;
    top: 0.75rem;
}

.reward-qr-item img {
    border: 1px solid #eee;
}

/* 文章标签 */
.post-tags a {
    display: inline-block;
    background: var(--theme-bg-light);
    color: var(--theme-text-light);
    padding: 0.25rem 0.75rem;
    border-radius: 3px;
    font-size: 0.8rem;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
}

.post-tags a:hover {
    background: var(--theme-primary);
    color: #ffffff;
}

/* 相关文章 */
.related-posts {
    padding: 1rem 0;
}

.related-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--theme-text);
}

.related-item {
    padding: 0.5rem;
    border-radius: var(--theme-radius);
    transition: background 0.2s ease;
}

.related-item:hover {
    background: var(--theme-bg-light);
}

.related-thumb {
    width: 80px;
    height: 55px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}

.related-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.related-item-title {
    font-size: 0.85rem;
    font-weight: 400;
    margin: 0 0 0.25rem;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.related-item-title a {
    color: var(--theme-text);
}

.related-item-title a:hover {
    color: var(--theme-primary);
}

.related-item-meta {
    font-size: 0.75rem;
}

/* ========================================
   8. 独立页面
   ======================================== */

.page-single {
    max-width: 100%;
    margin: 0 auto;
}

.page-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--theme-text);
}

.page-content {
    font-size: 1rem;
    line-height: 1.8;
    color: #555;
}

/* ========================================
   9. 归档页面
   ======================================== */

.archive-page {
    max-width: 700px;
    margin: 0 auto;
}

.archive-year {
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.archive-year-title {
    font-size: 1.25rem;
    color: var(--theme-text);
    font-weight: 700;
}

.archive-year-items {
    padding-left: 1rem;
}

.archive-item {
    padding: 0.5rem 0;
    border-bottom: 1px dashed var(--theme-border);
    font-size: 0.925rem;
}

.archive-item:last-child {
    border-bottom: none;
}

.archive-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--theme-primary);
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.archive-date {
    font-size: 0.85rem;
    min-width: 90px;
    flex-shrink: 0;
}

.archive-link {
    color: var(--theme-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.archive-link:hover {
    color: var(--theme-primary);
}

/* ========================================
   10. 友情链接页面
   ======================================== */

.links-page {
    max-width: 900px;
    margin: 0 auto;
}

.link-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: var(--theme-radius);
    background: var(--theme-bg-light);
    color: var(--theme-text);
    transition: all 0.2s ease;
    text-decoration: none;
}

.link-item:hover {
    background: #e9ecef;
    color: var(--theme-text);
    text-decoration: none;
    transform: translateX(3px);
}

.link-avatar img {
    width: 40px;
    height: 40px;
    object-fit: cover;
}

.link-avatar-placeholder {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--theme-border);
    color: var(--theme-text-light);
}

.link-name {
    font-size: 0.925rem;
    font-weight: 500;
}

.link-desc {
    font-size: 0.8rem;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 250px;
}

/* ========================================
   11. 标签页面
   ======================================== */

.tags-page {
    max-width: 900px;
    margin: 0 auto;
}

.tags-cloud {
    padding: 1rem 0;
}

.tag-item {
    display: inline-block;
    padding: 0.4rem 1.2rem;
    color: var(--theme-text);
    font-size: 0.95rem;
    transition: all 0.2s ease;
    text-decoration: none;
}

.tag-item:hover {
    color: var(--theme-primary);
    text-decoration: none;
}

/* ========================================
   12. 归档/分类/标签列表页
   ======================================== */

.archive-header {
    padding: 1rem 0;
}

.archive-title {
    font-size: 1.5rem;
    font-weight: 600;
}

.archive-desc {
    font-size: 0.9rem;
}

/* ========================================
   13. 评论区域
   ======================================== */

.comments-area {
    max-width: 100%;
    margin: 2rem auto 0;
}

.comments-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--theme-text);
}

/* 评论列表 */
.comment-item {
    padding: 1rem 0;
    border-bottom: 1px solid var(--theme-border);
}

.comment-item:last-child {
    border-bottom: none;
}

.comment-avatar img {
    border-radius: 50%;
    width: 48px;
    height: 48px;
}

.comment-author {
    color: var(--theme-text);
    font-size: 0.925rem;
}

.comment-date {
    font-size: 0.8rem;
}

.comment-text {
    font-size: 0.925rem;
    line-height: 1.6;
    color: #555;
    margin-top: 0.25rem;
}

.comment-text p {
    margin: 0;
}

.comment-actions a {
    font-size: 0.8rem;
    color: var(--theme-text-light);
}

.comment-actions a:hover {
    color: var(--theme-primary);
}

.comment-children {
    border-left: 2px solid var(--theme-border);
    padding-left: 1rem;
}

.comment-by-author .comment-author {
    color: var(--theme-primary);
}

/* 评论表单 */
.comment-respond {
    padding-top: 1rem;
}

.comment-respond .form-control {
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius);
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
}

.comment-respond .form-control:focus {
    border-color: var(--theme-primary);
    box-shadow: 0 0 0 0.15rem rgba(67, 206, 162, 0.15);
}

.comment-textarea {
    resize: vertical;
    min-height: 100px;
    padding-right: 3.5rem !important;
}

.btn-submit-comment {
    position: absolute;
    bottom: 0.75rem;
    right: 0.75rem;
    background: var(--theme-primary);
    color: #ffffff;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
    font-size: 0.9rem;
}

.btn-submit-comment:hover {
    background: var(--theme-primary-dark);
}

/* ========================================
   14. 页脚
   ======================================== */

.site-footer {
    background: var(--theme-bg-light);
    padding: 1.25rem 0;
    margin-top: auto;
    font-size: 0.85rem;
    color: var(--theme-text-light);
    border-top: 1px solid var(--theme-border);
}

.footer-nav {
    text-align: center;
}

.footer-nav-list {
    display: flex;
    align-items: center;
    justify-content: start;
    flex-wrap: wrap;
    gap: 1rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-nav-item {
    position: relative;
}

.footer-nav-item:not(:last-child)::after {
    content: '·';
    position: absolute;
    right: -0.75rem;
    top: 0;
    color: #ccc;
    font-size: 0.85rem;
}

.footer-nav-link {
    color: var(--theme-text-light);
    font-size: 0.85rem;
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-nav-link:hover {
    color: var(--theme-primary);
}

.footer-info {
    font-size: 0.85rem;
    color: var(--theme-text-light);
}

.footer-info a {
    color: var(--theme-text-light);
}

.footer-info a:hover {
    color: var(--theme-primary);
}

/* ========================================
   15. 回到顶部
   ======================================== */

.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 48px;
    height: 48px;
    background: #43cea2;
    color: #ffffff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    cursor: pointer;
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    box-shadow: 0 2px 10px rgba(67, 206, 162, 0.3);
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(76, 217, 100, 0.4);
}

/* ========================================
   16. 404 页面
   ======================================== */

.page-404 {
    text-align: center;
    padding: 4rem 0;
}

.page-404 h1 {
    font-size: 6rem;
    font-weight: 700;
    color: var(--theme-primary);
    margin-bottom: 1rem;
}

.page-404 p {
    font-size: 1.25rem;
    color: var(--theme-text-light);
    margin-bottom: 2rem;
}

.page-404 .btn-home {
    background: var(--theme-primary);
    color: #ffffff;
    padding: 0.6rem 2rem;
    border-radius: 50px;
    font-size: 1rem;
    transition: background 0.2s ease;
    text-decoration: none;
}

.page-404 .btn-home:hover {
    background: var(--theme-primary-dark);
    color: #ffffff;
    text-decoration: none;
}

/* ========================================
   17. 无文章提示
   ======================================== */

.no-posts {
    padding: 3rem 0;
}

.no-posts h3 {
    font-size: 1.25rem;
}

/* ========================================
   18. 响应式样式
   ======================================== */

@media (max-width: 991.98px) {
    .navbar-nav {
        padding: 0.5rem 0;
    }
    
    .navbar-nav .nav-link {
        padding: 0.5rem 0 !important;
    }
}

@media (max-width: 767.98px) {
    .banner-section {
        padding: 2rem 0 2.5rem;
    }
    
    .banner-title {
        font-size: 1.5rem;
    }
    
    .banner-desc {
        font-size: 0.9rem;
    }
    
    .search-box {
        max-width: 100%;
        padding: 0 1rem;
    }
    
    .post-single {
        padding: 0;
    }
    
    .post-title {
        font-size: 1.25rem;
    }
    
    .related-thumb {
        width: 60px;
        height: 42px;
    }
    
    .site-footer .row {
        text-align: center;
    }
    
    .site-footer .text-md-right {
        text-align: center !important;
        margin-top: 0.5rem;
    }
    
    .footer-nav {
        text-align: center;
    }
    
    .back-to-top {
        bottom: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .comment-respond .row .col-md-4 {
        margin-bottom: 0.5rem;
    }
}

@media (max-width: 575.98px) {
    .post-card-body {
        padding: 0.75rem;
    }
    
    .post-card-title {
        font-size: 0.85rem;
    }
    
    .link-item {
        padding: 0.6rem 0.75rem;
    }
}

/* ========================================
   19. 打印样式
   ========================================

@media print {
    .navbar,
    .banner-section,
    .back-to-top,
    .site-footer,
    .post-actions,
    .related-posts,
    .comments-area,
    .pagination-nav,
    .search-box {
        display: none !important;
    }
    
    .main-content {
        padding: 0;
    }
    
    .post-single {
        max-width: 100%;
    }
}

/* ========================================
   20. 动画
   ======================================== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.post-card {
    animation: fadeInUp 0.4s ease forwards;
}

.post-grid .col-md-4:nth-child(1) .post-card { animation-delay: 0.05s; }
.post-grid .col-md-4:nth-child(2) .post-card { animation-delay: 0.1s; }
.post-grid .col-md-4:nth-child(3) .post-card { animation-delay: 0.15s; }
.post-grid .col-md-4:nth-child(4) .post-card { animation-delay: 0.2s; }
.post-grid .col-md-4:nth-child(5) .post-card { animation-delay: 0.25s; }
.post-grid .col-md-4:nth-child(6) .post-card { animation-delay: 0.3s; }
.post-grid .col-md-4:nth-child(7) .post-card { animation-delay: 0.35s; }
.post-grid .col-md-4:nth-child(8) .post-card { animation-delay: 0.4s; }
.post-grid .col-md-4:nth-child(9) .post-card { animation-delay: 0.45s; }
.post-grid .col-md-4:nth-child(10) .post-card { animation-delay: 0.5s; }
.post-grid .col-md-4:nth-child(11) .post-card { animation-delay: 0.55s; }
.post-grid .col-md-4:nth-child(12) .post-card { animation-delay: 0.6s; }

/* ========================================
   21. 页面链接激活的按钮样式
   ======================================== */

.pagination .page-link a {
    color: inherit;
    text-decoration: none;
}

.pagination .active .page-link a {
    color: #ffffff;
}
