/**
 * 檔案名稱：assets/css/simple-related-posts.css
 * 簡化相關文章推薦系統樣式
 * 版本：1.0.0
 * 說明：為簡化相關文章推薦提供美觀的CSS樣式
 */

/* 1. 主容器樣式 */
.tkt-simple-related-posts {
    margin: 30px 0;
    padding: 25px;
    background: #f9f9f9;
    border-radius: 8px;
    border-left: 4px solid #0073aa;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* 2. 標題樣式 */
.tkt-simple-related-posts .related-posts-title {
    margin: 0 0 20px 0;
    padding: 0;
    font-size: 1.4em;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 10px;
}

/* 3. 網格容器 */
.related-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

/* 4. 單個相關文章項目 */
.related-post-item {
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #e1e1e1;
}

.related-post-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* 5. 縮圖樣式 */
.related-post-thumbnail {
    position: relative;
    overflow: hidden;
    height: 160px;
    background: #f0f0f0;
}

.related-post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.related-post-thumbnail:hover img {
    transform: scale(1.05);
}

.related-post-thumbnail a {
    display: block;
    width: 100%;
    height: 100%;
}

/* 6. 內容區域 */
.related-post-content {
    padding: 15px;
}

/* 7. 標題樣式 */
.related-post-title {
    margin: 0 0 10px 0;
    font-size: 1.1em;
    line-height: 1.4;
}

.related-post-title a {
    color: #333;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.related-post-title a:hover {
    color: #0073aa;
    text-decoration: none;
}

/* 8. 摘要樣式 */
.related-post-excerpt {
    margin: 0 0 10px 0;
    color: #666;
    font-size: 0.9em;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 9. 日期樣式 */
.related-post-date {
    color: #999;
    font-size: 0.8em;
    font-style: italic;
}

/* 10. 響應式設計 */
@media (max-width: 768px) {
    .tkt-simple-related-posts {
        margin: 20px 0;
        padding: 15px;
    }
    
    .related-posts-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .related-post-thumbnail {
        height: 140px;
    }
    
    .related-posts-title {
        font-size: 1.2em;
    }
}

@media (max-width: 480px) {
    .tkt-simple-related-posts {
        margin: 15px 0;
        padding: 10px;
    }
    
    .related-post-content {
        padding: 10px;
    }
    
    .related-post-thumbnail {
        height: 120px;
    }
}

/* 11. 無縮圖時的樣式 */
.related-post-item:not(.has-thumbnail) .related-post-content {
    padding-top: 20px;
}

/* 12. 載入動畫 */
.tkt-simple-related-posts.loading {
    opacity: 0.7;
    pointer-events: none;
}

.tkt-simple-related-posts.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #0073aa;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

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

/* 13. 空狀態樣式 */
.tkt-simple-related-posts.empty {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 40px 20px;
}

/* 14. 深色主題支援 */
@media (prefers-color-scheme: dark) {
    .tkt-simple-related-posts {
        background: #2c2c2c;
        color: #e0e0e0;
        border-left-color: #4a9eff;
    }
    
    .related-posts-title {
        color: #e0e0e0;
        border-bottom-color: #4a9eff;
    }
    
    .related-post-item {
        background: #3c3c3c;
        border-color: #555;
    }
    
    .related-post-title a {
        color: #e0e0e0;
    }
    
    .related-post-title a:hover {
        color: #4a9eff;
    }
    
    .related-post-excerpt {
        color: #b0b0b0;
    }
    
    .related-post-date {
        color: #888;
    }
}

/* 15. 列表佈局（備用） */
.tkt-simple-related-posts.layout-list .related-posts-grid {
    display: block;
}

.tkt-simple-related-posts.layout-list .related-post-item {
    display: flex;
    margin-bottom: 15px;
    align-items: flex-start;
}

.tkt-simple-related-posts.layout-list .related-post-thumbnail {
    width: 120px;
    height: 80px;
    flex-shrink: 0;
    margin-right: 15px;
}

.tkt-simple-related-posts.layout-list .related-post-content {
    flex: 1;
    padding: 0;
}

/* 16. 緊湊佈局 */
.tkt-simple-related-posts.compact {
    padding: 15px;
}

.tkt-simple-related-posts.compact .related-posts-grid {
    gap: 10px;
}

.tkt-simple-related-posts.compact .related-post-item {
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.tkt-simple-related-posts.compact .related-post-thumbnail {
    height: 120px;
}

.tkt-simple-related-posts.compact .related-post-content {
    padding: 10px;
}

/* 17. 打印樣式 */
@media print {
    .tkt-simple-related-posts {
        background: none;
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .related-post-item {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .related-post-thumbnail {
        display: none;
    }
}