/* 部落格列表卡片樣式 */
.blog-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.blog-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.blog-card a {
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.blog-card-image {
    width: 100%;
    height: 220px;
    overflow: hidden;
    background: #f8f9fa;
    position: relative;
}

.blog-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.blog-card:hover .blog-card-image img {
    transform: scale(1.05);
}

.blog-card-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-size: 4rem;
}

.blog-card-body {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.blog-card-meta {
    margin-bottom: 0.75rem;
}

.blog-card-date {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #6c757d;
}

.blog-card-date i {
    font-size: 1rem;
}

.blog-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #212529;
    margin-bottom: 0.75rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.blog-card-summary {
    font-size: 0.95rem;
    color: #6c757d;
    line-height: 1.6;
    margin-bottom: 1rem;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.blog-card-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid #f0f0f0;
}

.blog-card-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #667eea;
    font-weight: 500;
    font-size: 0.95rem;
    transition: gap 0.3s ease;
}

.blog-card:hover .blog-card-link {
    gap: 0.75rem;
}

.blog-card-link i {
    transition: transform 0.3s ease;
}

.blog-card:hover .blog-card-link i {
    transform: translateX(4px);
}

/* 部落格詳細頁面樣式 */
.blog-detail-container {
    max-width: 800px;
    margin: 0 auto;
}

.blog-detail-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid #f0f0f0;
}

.blog-detail-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #212529;
    margin-bottom: 1rem;
    line-height: 1.3;
}

.blog-detail-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    color: #6c757d;
    font-size: 0.95rem;
}

.blog-detail-meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.blog-detail-thumbnail {
    width: 100%;
    max-height: 500px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 2rem;
}

.blog-detail-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #343a40;
}

.blog-detail-content h1,
.blog-detail-content h2,
.blog-detail-content h3,
.blog-detail-content h4 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.blog-detail-content p {
    margin-bottom: 1.5rem;
}

.blog-detail-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1.5rem 0;
}

.blog-detail-content ul,
.blog-detail-content ol {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
}

.blog-detail-content li {
    margin-bottom: 0.5rem;
}

.blog-detail-content blockquote {
    border-left: 4px solid #667eea;
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    color: #6c757d;
    font-style: italic;
}

.blog-detail-content code {
    background: #f8f9fa;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9em;
    color: #e83e8c;
}

.blog-detail-content pre {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.5rem 0;
}

.blog-detail-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.blog-detail-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
    padding: 0.5rem 1rem;
    background: #f8f9fa;
    color: #495057;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.blog-detail-back-btn:hover {
    background: #e9ecef;
    color: #212529;
    transform: translateX(-4px);
}

/* 響應式設計 */
@media (max-width: 768px) {
    .blog-card-title {
        font-size: 1.1rem;
    }

    .blog-detail-title {
        font-size: 1.75rem;
    }

    .blog-detail-meta {
        flex-direction: column;
        gap: 0.5rem;
    }

    .blog-detail-content {
        font-size: 1rem;
    }
}

/* 載入動畫 */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.blog-card-loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

/* 側邊欄樣式 */
.sidebar-widget {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.sidebar-widget-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #212529;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #667eea;
    display: flex;
    align-items: center;
}

.sidebar-widget-title i {
    color: #667eea;
}

/* 近期文章列表 */
.recent-posts-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.recent-post-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.recent-post-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.recent-post-item:first-child {
    padding-top: 0;
}

.recent-post-link {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    text-decoration: none;
    transition: all 0.2s ease;
}

.recent-post-link:hover .recent-post-title {
    color: #667eea;
}

.recent-post-title {
    font-size: 0.95rem;
    font-weight: 500;
    color: #343a40;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s ease;
}

.recent-post-date {
    font-size: 0.8rem;
    color: #6c757d;
    display: flex;
    align-items: center;
}

.recent-post-date i {
    font-size: 0.75rem;
}

/* 分類列表 */
.category-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.category-item {
    margin-bottom: 0.5rem;
}

.category-item:last-child {
    margin-bottom: 0;
}

.category-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.75rem;
    text-decoration: none;
    border-radius: 8px;
    background: #f8f9fa;
    transition: all 0.2s ease;
}

.category-link:hover {
    background: #e9ecef;
}

.category-item.active .category-link {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.category-item.active .category-name,
.category-item.active .category-count {
    color: #fff;
}

.category-name {
    font-size: 0.95rem;
    font-weight: 500;
    color: #343a40;
}

.category-count {
    font-size: 0.85rem;
    color: #6c757d;
    background: #e9ecef;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    min-width: 28px;
    text-align: center;
}

.category-item.active .category-count {
    background: rgba(255, 255, 255, 0.2);
}

/* 側邊欄響應式設計 */
@media (max-width: 991.98px) {
    .sidebar-widget {
        margin-top: 0;
    }

    .category-list {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .category-item {
        margin-bottom: 0;
    }

    .category-link {
        padding: 0.5rem 0.75rem;
    }

    .recent-posts-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .recent-post-item {
        padding: 0;
        border-bottom: none;
        background: #f8f9fa;
        border-radius: 8px;
        padding: 0.75rem;
    }
}

@media (max-width: 575.98px) {
    .recent-posts-list {
        grid-template-columns: 1fr;
    }
}

/* 文章目錄樣式 */
.article-toc {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border-left: 4px solid #667eea;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.article-toc-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.article-toc-title i {
    color: #667eea;
}

.article-toc-nav {
    margin: 0;
}

.article-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: toc-counter;
}

.article-toc-item {
    margin-bottom: 0.5rem;
    counter-increment: toc-counter;
}

.article-toc-item:last-child {
    margin-bottom: 0;
}

.article-toc-link {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    text-decoration: none;
    color: #495057;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    line-height: 1.4;
}

.article-toc-link::before {
    content: counter(toc-counter);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    background: #667eea;
    color: #fff;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 600;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.article-toc-link:hover {
    background: #fff;
    color: #667eea;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.article-toc-link:hover::before {
    background: #764ba2;
}

/* 目錄響應式設計 */
@media (max-width: 768px) {
    .article-toc {
        padding: 1rem;
    }

    .article-toc-title {
        font-size: 1.1rem;
    }

    .article-toc-link {
        font-size: 0.9rem;
        padding: 0.4rem 0.5rem;
    }

    .article-toc-link::before {
        min-width: 20px;
        height: 20px;
        font-size: 0.75rem;
        margin-right: 0.5rem;
    }
}
