/* 
 * Articles Components Styles
 * 文章相關頁面的專用樣式
 */

/* ==========================================================================
   Article List & Grid Layout
   ========================================================================== */

.articles-container {
    padding: 40px 0;
}

.articles-page-header {
    text-align: center;
    margin-bottom: 50px;
}

.articles-page-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 15px;
}

.articles-page-description {
    font-size: 1.1rem;
    color: #666;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Main Articles Grid */
/* Legacy styles - commented out to avoid conflicts
#articles-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    margin: 0;
    padding: 0;
}
*/

.article-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    border: 1px solid rgba(0,0,0,0.05);
    height: fit-content;
}

.article-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.article-link {
    display: block;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

/* Article Cover */
.article-cover {
    position: relative;
    width: 100%;
    height: 250px;
    overflow: hidden;
    background: #f8f9fa;
}

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

.article-card:hover .article-cover-image {
    transform: scale(1.05);
}

.article-cover-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, #f8f9fa, #e9ecef);
    color: #6c757d;
    font-size: 3rem;
}

/* Article Category Badge */
.article-category {
    position: absolute;
    bottom: 15px;
    right: 15px;
    width: 50px;
    height: 50px;
    line-height: 50px;
    color: #FFFFFF;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    backdrop-filter: blur(5px);
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* Article Date */
.article-date {
    position: absolute;
    top: 15px;
    left: 15px;
    color: #FFFFFF;
    letter-spacing: 1px;
    font-size: 14px;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0,0,0,0.7);
    background: rgba(0, 0, 0, 0.5);
    padding: 6px 12px;
    border-radius: 15px;
    backdrop-filter: blur(5px);
}

/* Article Info */
.article-info {
    padding: 25px;
}

.article-title {
    font-family: 'Noto Serif TC', Merriweather, serif;
    font-weight: 600;
    font-size: 1.3rem;
    line-height: 1.5;
    color: #333;
    margin: 0 0 15px 0;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    min-height: 3.6rem;
}

.article-excerpt {
    color: #666;
    font-size: 1rem;
    line-height: 1.6;
    margin: 0 0 15px 0;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
}

.article-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #999;
    font-size: 0.9rem;
    margin-top: auto;
}

.article-author {
    display: flex;
    align-items: center;
    gap: 8px;
}

.author-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid #eee;
}

.article-stats {
    display: flex;
    gap: 15px;
}

.article-stats .stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.85rem;
}

/* ==========================================================================
   Article Filters & Categories
   ========================================================================== */

.article-filters {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 40px;
    padding: 25px;
    background: #f8f9fa;
    border-radius: 15px;
}

.category-filter {
    padding: 10px 20px;
    background: white;
    border: 2px solid #ddd;
    border-radius: 25px;
    text-decoration: none;
    color: #666;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 0.95rem;
}

.category-filter:hover,
.category-filter.active {
    text-decoration: none;
    color: #FF6B6B;
    border-color: #FF6B6B;
    background: rgba(255, 107, 107, 0.1);
    transform: translateY(-2px);
}

.category-all {
    background: linear-gradient(45deg, #8336D6, #943ddf);
    color: white;
    border-color: #8336D6;
}

.category-all:hover {
    color: white;
    background: linear-gradient(45deg, #943ddf, #a547e8);
    border-color: #943ddf;
}

/* Article Search */
.article-search {
    position: relative;
    max-width: 500px;
    margin: 0 auto 40px auto;
}

.article-search input {
    width: 100%;
    padding: 15px 50px 15px 20px;
    border: 2px solid #eee;
    border-radius: 25px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

.article-search input:focus {
    outline: none;
    border-color: #FF6B6B;
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.1);
}

.article-search button {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 35px;
    height: 35px;
    background: #FF6B6B;
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.article-search button:hover {
    background: #ff5555;
    transform: translateY(-50%) scale(1.1);
}

/* ==========================================================================
   Featured Articles
   ========================================================================== */

.featured-articles {
    margin-bottom: 50px;
}

.featured-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 30px;
    text-align: center;
    position: relative;
}

.featured-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #FF6B6B, #8336D6);
    border-radius: 2px;
}

.featured-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

.featured-main {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    background: white;
}

.featured-main .article-cover {
    height: 350px;
}

.featured-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.featured-sidebar .article-card {
    display: flex;
    gap: 15px;
    padding: 15px;
}

.featured-sidebar .article-cover {
    width: 120px;
    height: 120px;
    flex-shrink: 0;
    border-radius: 10px;
}

.featured-sidebar .article-info {
    padding: 0;
    flex: 1;
}

.featured-sidebar .article-title {
    font-family: 'Noto Serif TC', serif;
    font-size: 1.1rem;
    margin-bottom: 8px;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}

.featured-sidebar .article-excerpt {
    font-size: 0.9rem;
    margin-bottom: 8px;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}

/* ==========================================================================
   Article Tags
   ========================================================================== */

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
}

.article-tag {
    padding: 4px 10px;
    background: #f0f0f0;
    color: #666;
    border-radius: 12px;
    font-size: 0.8rem;
    text-decoration: none;
    transition: all 0.3s ease;
}

.article-tag:hover {
    background: #FF6B6B;
    color: white;
    text-decoration: none;
}

/* ==========================================================================
   Article Loading States
   ========================================================================== */

.article-skeleton {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.article-skeleton-cover {
    width: 100%;
    height: 250px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

.article-skeleton-content {
    padding: 25px;
}

.article-skeleton-title {
    height: 20px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 15px;
}

.article-skeleton-text {
    height: 12px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 8px;
}

.article-skeleton-text:last-child {
    width: 60%;
}

@keyframes loading {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* ==========================================================================
   Article Detail Page
   ========================================================================== */

.article-detail {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
}

.article-detail-header {
    text-align: center;
    margin-bottom: 40px;
}

.article-detail-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 20px;
    line-height: 1.3;
}

.article-detail-meta {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    color: #666;
    font-size: 1rem;
    margin-bottom: 30px;
}

.article-detail-cover {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: 15px;
    margin-bottom: 40px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.article-detail-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #444;
}

.article-detail-content h2,
.article-detail-content h3 {
    margin-top: 40px;
    margin-bottom: 20px;
    color: #333;
}

.article-detail-content p {
    margin-bottom: 20px;
}

.article-detail-content img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    margin: 20px 0;
}

/* ==========================================================================
   Responsive Article Styles
   ========================================================================== */

@media (max-width: 1024px) {
    #articles-list {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 25px;
    }
    
    .featured-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }
    
    .featured-main .article-cover {
        height: 300px;
    }
}

@media (max-width: 768px) {
    #articles-list {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 20px;
    }
    
    .article-info {
        padding: 20px;
    }
    
    .article-title {
        font-size: 1.2rem;
    }
    
    .article-filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .category-filter {
        text-align: center;
        justify-content: center;
    }
    
    .featured-sidebar .article-card {
        flex-direction: column;
    }
    
    .featured-sidebar .article-cover {
        width: 100%;
        height: 150px;
    }
    
    .article-detail-title {
        font-size: 2rem;
    }
    
    .article-detail-meta {
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    #articles-list {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .article-cover {
        height: 200px;
    }
    
    .article-info {
        padding: 15px;
    }
    
    .article-title {
        font-size: 1.1rem;
        margin-bottom: 10px;
    }
    
    .article-excerpt {
        font-size: 0.95rem;
        margin-bottom: 10px;
    }
    
    .article-category {
        width: 40px;
        height: 40px;
        line-height: 40px;
        font-size: 12px;
        bottom: 10px;
        right: 10px;
    }
    
    .article-date {
        top: 10px;
        left: 10px;
        font-size: 12px;
        padding: 4px 8px;
    }
    
    .article-search {
        max-width: 100%;
    }
    
    .article-search input {
        padding: 12px 45px 12px 15px;
        font-size: 0.95rem;
    }
    
    .article-search button {
        width: 30px;
        height: 30px;
        right: 8px;
    }
    
    .featured-main .article-cover {
        height: 200px;
    }
    
    .article-detail {
        padding: 20px 15px;
    }
    
    .article-detail-title {
        font-size: 1.8rem;
    }
    
    .article-detail-content {
        font-size: 1rem;
    }
}

/* ==========================================================================
   Category Tabs Styles (文章分類標籤) - 已移至application.css統一管理
   ========================================================================== */

/* 響應式設計 - 手機版標籤樣式調整 */
@media (max-width: 768px) {
    body.articles-page .category-tabs ul.category-nav {
        justify-content: center !important;
        gap: 8px !important;
    }
    
    body.articles-page .category-tabs ul.category-nav li a.category-tab {
        padding: 8px 15px !important;
        font-size: 13px !important;
    }
    
    body.articles-page .sort-tabs ul.order {
        justify-content: space-around !important;
    }
    
    body.articles-page .sort-tabs ul.order li {
        margin: 0 10px !important;
    }
}

/* 排序選項 Tab - 下方 */
body.articles-page .sort-tabs {
    margin-bottom: 30px !important;
    border-bottom: 1px solid #e9ecef !important;
    width: 100% !important;
}

body.articles-page .sort-tabs ul.order {
    display: flex !important;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    justify-content: center !important;
    width: 100% !important;
}

body.articles-page .sort-tabs ul.order li {
    margin: 0 20px !important;
    display: list-item !important;
}

body.articles-page .sort-tabs ul.order li a {
    display: block !important;
    padding: 15px 0 !important;
    color: #666 !important;
    text-decoration: none !important;
    border-bottom: 3px solid transparent !important;
    transition: all 0.3s !important;
    font-size: 16px !important;
    font-weight: 500 !important;
}

body.articles-page .sort-tabs ul.order li a.active,
body.articles-page .sort-tabs ul.order li a:hover {
    color: #FF6B6B !important;
    border-bottom-color: #FF6B6B !important;
    text-decoration: none !important;
}

/* ==========================================================================
   Tab Styles for Articles Page
   ========================================================================== */

/* Tab 樣式 - 確保在articles頁面正確顯示 */
body.articles-page .tab {
    margin-bottom: 30px !important;
    border-bottom: 1px solid #e9ecef !important;
    width: 100% !important;
}

body.articles-page .tab ul.order {
    display: flex !important;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    justify-content: center !important;
    width: 100% !important;
}

body.articles-page .tab ul.order li {
    margin: 0 20px !important;
    display: list-item !important;
}

body.articles-page .tab ul.order li a {
    display: block !important;
    padding: 15px 0 !important;
    color: #666 !important;
    text-decoration: none !important;
    border-bottom: 3px solid transparent !important;
    transition: all 0.3s !important;
    font-size: 16px !important;
    font-weight: 500 !important;
}

body.articles-page .tab ul.order li a.active,
body.articles-page .tab ul.order li a:hover {
    color: #FF6B6B !important;
    border-bottom-color: #FF6B6B !important;
    text-decoration: none !important;
}

body.articles-page .tab .category {
    text-align: center !important;
    margin-bottom: 20px !important;
}

body.articles-page .tab .category h1 {
    font-size: 1.5rem !important;
    font-weight: bold !important;
    color: #333 !important;
    margin: 0 !important;
    padding: 10px 0 !important;
}

/* ==========================================================================
   Articles Page Layout Override - 最高優先級
   ========================================================================== */

/* 確保articles頁面使用正確的容器設定 */
body.articles-page #container {
    max-width: 1200px !important;
    width: 100% !important;
    padding: 70px 40px 40px 40px !important;
    margin: 0 auto !important;
}

/* 確保articles-list使用全寬度 */
body.articles-page #articles-list {
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
}

/* 文章網格 - 強制覆蓋所有可能的衝突樣式 */
body.articles-page .articles-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 30px !important;
    margin-bottom: 30px !important;
    max-width: 100% !important;
    width: 100% !important;
    list-style: none !important;
    padding: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* 確保每個文章項目正確顯示 */
body.articles-page .article-item {
    background: white !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1) !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease !important;
    position: relative !important;
    display: block !important;
    width: 100% !important;
    height: auto !important;
    float: none !important;
    margin: 0 !important;
}

/* ==========================================================================
   Articles Grid Layout (for articles list page)
   ========================================================================== */

/* 文章網格 - 強制覆蓋所有可能的衝突樣式 */
body.articles-page #articles-list .articles-grid,
body.articles-page .articles-grid,
.articles-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 30px !important;
    margin-bottom: 30px !important;
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

body.articles-page .article-item,
.article-item {
    background: white !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1) !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease !important;
    position: relative !important;
    display: block !important;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    float: none !important;
}

.article-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.article-item a {
    text-decoration: none;
    color: inherit;
    display: block;
}

.article-image {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
}

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

.article-item:hover .article-image img {
    transform: scale(1.05);
}

.article-info {
    padding: 20px;
}

.article-info h4 {
    font-family: 'Noto Serif TC', serif;
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 10px 0;
    line-height: 1.4;
    color: #333;
}

.article-info .description {
    font-size: 14px;
    color: #666;
    line-height: 1.5;
    margin: 0 0 15px 0;
}

.article-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #999;
}

.article-meta .date {
    color: #999;
}

.article-meta .views {
    color: #999;
}

.category-tag {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 2;
    writing-mode: horizontal-tb;
}

.category-tag .category {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    text-decoration: none;
    font-weight: 500;
    writing-mode: horizontal-tb;
    white-space: nowrap;
}

.category-tag .category:hover {
    background: rgba(0, 0, 0, 0.9);
    color: white;
    text-decoration: none;
}

/* 響應式設計 - 強化文章網格 */
@media (max-width: 768px) {
    body.articles-page #container {
        padding: 70px 20px 40px 20px !important;
    }
    
    body.articles-page #articles-list .articles-grid,
    body.articles-page .articles-grid,
    .articles-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
    
    .article-info {
        padding: 15px;
    }
    
    .article-info h4 {
        font-size: 15px;
    }
    
    .article-info .description {
        font-size: 13px;
    }
}

/* 平板版設計 */
@media (min-width: 769px) and (max-width: 1024px) {
    body.articles-page #articles-list .articles-grid,
    body.articles-page .articles-grid,
    .articles-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 25px !important;
    }
}

@media (min-width: 769px) {
    .articles-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 30px !important;
    }
}
