/* Articles Page Specific Styles */

/* 特色文章區域 */
.featured-section {
    background: white;
    padding: 40px 0;
    border-bottom: 1px solid var(--border-color);
}

.featured-article {
    position: relative;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: var(--transition);
}

.featured-article:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-md);
}

.featured-image {
    width: 100%;
    height: 400px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 4rem;
    position: relative;
    overflow: hidden;
}

.featured-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    padding: 40px 32px 32px;
    color: white;
}

.featured-category {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 12px;
    backdrop-filter: blur(10px);
}

.featured-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 12px;
    line-height: 1.3;
}

.featured-excerpt {
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: 16px;
    line-height: 1.5;
}

.featured-meta {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    opacity: 0.8;
}

/* 分類標籤 */
.category-section {
    background: white;
    padding: 30px 0;
    border-bottom: 1px solid var(--border-color);
}



/* 文章卡片 */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 32px;
    margin-top: 40px;
}

.article-card {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    cursor: pointer;
}

.article-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.article-image {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 3rem;
    position: relative;
}

.article-content {
    padding: 24px;
}

.article-category {
    display: inline-block;
    background: rgba(43, 56, 90, 0.1);
    color: var(--primary-color);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 12px;
}

.article-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    line-height: 1.4;
}

.article-excerpt {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.article-author {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.author-avatar {
    width: 24px;
    height: 24px;
    background: var(--primary-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: 500;
}

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

.stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}

.stat-item i {
    color: var(--primary-color);
}

/* 側邊欄 */
.sidebar-widgets {
    background: white;
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    position: sticky;
    top: 200px;
}

.widget {
    margin-bottom: 32px;
}

.widget:last-child {
    margin-bottom: 0;
}

.widget-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 熱門文章 */
.popular-articles {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.popular-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    transition: var(--transition);
    cursor: pointer;
}

.popular-item:hover {
    background: var(--bg-primary);
}

.popular-image {
    width: 60px;
    height: 60px;
    background: var(--primary-gradient);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.popular-content {
    flex: 1;
}

.popular-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.popular-date {
    font-size: 12px;
    color: var(--text-secondary);
}

/* 標籤雲 */
.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-item {
    padding: 6px 12px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    font-size: 12px;
    text-decoration: none;
    transition: var(--transition);
}

.tag-item:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

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

    .featured-meta {
        gap: 16px;
    }



    .articles-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .sidebar-widgets {
        position: static;
        margin-top: 24px;
    }
}

/* ============================================
   美業專欄頁面 - Modern Redesign
   ============================================ */

/* 全局變數 - 使用網站主色調 */
:root {
    --articles-primary: var(--primary, var(--color-primary));
    --articles-primary-dark: var(--primary-dark, var(--color-primary-dark));
    --articles-bg: var(--bg-body, var(--bg-body));
    --text-secondary: var(--text-light, #999999);
    --border-color: rgba(170, 145, 119, 0.15);
}

body {
    background-color: var(--articles-bg);
}

/* 容器 */
.articles-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* 統計卡片 */
.stats-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    height: 100%;
}

.stats-card:hover {
    border-color: var(--articles-primary);
    box-shadow: 0 4px 12px rgba(170, 145, 119, 0.1);
    transform: translateY(-2px);
}

.stats-number {
    font-size: 28px;
    font-weight: 700;
    color: var(--articles-primary);
    margin-bottom: 8px;
}

.stats-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* 控制區域 */
.articles-controls {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(170, 145, 119, 0.05);
}

.articles-search-input {
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.articles-search-input:focus {
    border-color: var(--articles-primary);
    box-shadow: 0 0 0 3px rgba(170, 145, 119, 0.1);
    outline: none;
}

.articles-filter-select {
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}

.articles-filter-select:hover {
    border-color: var(--articles-primary);
}

/* 文章卡片 - Modern Redesign */
.articles-container .article-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.articles-container .article-card:hover {
    border-color: var(--articles-primary);
    box-shadow: 0 4px 12px rgba(170, 145, 119, 0.15);
    transform: translateY(-2px);
}

.article-image-wrapper {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: var(--articles-bg);
    position: relative;
}

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

.articles-container .article-card:hover .article-image-wrapper img {
    transform: scale(1.05);
}

.article-badge {
    position: absolute;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    z-index: 10;
}

.article-badge.featured {
    top: 12px;
    left: 12px;
    background: rgba(220, 53, 69, 0.95);
    color: #fff;
}

.article-badge.pinned {
    top: 12px;
    left: 12px;
    background: rgba(255, 193, 7, 0.95);
    color: #000;
}

/* member-only / technician-only / category badge 定位已統一於下方新規則 */

.article-card-body {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.articles-container .article-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 12px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.articles-container .article-excerpt {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.6;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.articles-container .article-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    font-size: 13px;
    color: var(--text-secondary);
}

.article-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.article-meta-item i {
    font-size: 12px;
}

/* 按鈕 */
.btn-articles-primary {
    background: var(--articles-primary);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-articles-primary:hover {
    background: var(--articles-primary-dark);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(170, 145, 119, 0.2);
}

.btn-outline-articles {
    background: white;
    color: var(--articles-primary);
    border: 1.5px solid var(--articles-primary);
    border-radius: 8px;
    padding: 10px 16px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-outline-articles:hover {
    background: rgba(170, 145, 119, 0.05);
    color: var(--articles-primary-dark);
    border-color: var(--articles-primary-dark);
}

/* 空狀態 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.empty-state-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(170, 145, 119, 0.05);
    border-radius: 50%;
    color: var(--text-secondary);
}

/* badge 定位修正：member-only / technician-only 移至右上，不與左上 badge 重疊 */
.article-badge.member-only {
    top: 12px;
    right: 12px;
    left: auto;
    bottom: auto;
    background: rgba(111, 66, 193, 0.95);
    color: #fff;
}

.article-badge.technician-only {
    top: 12px;
    right: 12px;
    left: auto;
    bottom: auto;
    background: rgba(74, 144, 164, 0.95);
    color: #fff;
}

/* 分類 badge 固定在左下 */
.article-badge.category {
    top: auto;
    bottom: 12px;
    left: 12px;
    right: auto;
    background: rgba(170, 145, 119, 0.95);
    color: #fff;
}

/* ============================================
   分類 Chip 列樣式
   ============================================ */
.category-chips-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;       /* Firefox */
    margin-bottom: 1.5rem;
    cursor: grab;                /* 提示桌機使用者可拖曳橫向捲動 */
}

.category-chips-wrapper.is-dragging {
    cursor: grabbing;
    scroll-behavior: auto;
}

.category-chips-wrapper::-webkit-scrollbar {
    display: none;               /* Chrome / Safari */
}

.category-chips {
    display: flex;
    gap: 8px;
    padding: 4px 0;
    white-space: nowrap;
    min-width: max-content;
}

.category-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 50px;
    border: 1.5px solid var(--border-color, rgba(170, 145, 119, 0.3));
    background: white;
    color: var(--text-secondary, #888);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-height: 44px;            /* 手機版最小點擊區域 */
}

.category-chip:hover {
    border-color: var(--articles-primary, #AA9177);
    color: var(--articles-primary, #AA9177);
    background: rgba(170, 145, 119, 0.06);
}

.category-chip.active {
    background: var(--articles-primary, #AA9177);
    border-color: var(--articles-primary, #AA9177);
    color: white;
}

.chip-count {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    padding: 1px 6px;
    font-size: 11px;
}

.category-chip.active .chip-count {
    background: rgba(255, 255, 255, 0.25);
}

/* ============================================
   精選文章 Hero Banner 樣式
   ============================================ */
.featured-hero-banner {
    border-radius: 16px;
    overflow: hidden;
}

.featured-hero-image {
    position: relative;
    height: 280px;
}

.featured-hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.featured-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.75) 0%, transparent 60%);
}

.featured-hero-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px;
    color: white;
}

.featured-badge {
    background: var(--articles-primary, #AA9177);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.featured-hero-title {
    font-size: 22px;
    font-weight: 700;
    margin: 8px 0;
    line-height: 1.3;
}

.featured-hero-excerpt {
    font-size: 14px;
    opacity: 0.85;
    margin-bottom: 8px;
}

.featured-hero-meta {
    font-size: 12px;
    opacity: 0.75;
    display: flex;
    gap: 12px;
}

/* ============================================
   響應式 - Modern Redesign
   ============================================ */
@media (max-width: 767.98px) {
    .articles-container {
        padding: 20px 15px;
    }

    .article-image-wrapper {
        height: 180px;
    }

    .article-card-body {
        padding: 16px;
    }

    .articles-controls {
        padding: 16px;
    }

    /* Hero Banner 手機版縮小 */
    .featured-hero-image {
        height: 200px;
    }

    .featured-hero-title {
        font-size: 17px;
    }

    /* Chip 手機版稍微縮小字體 */
    .category-chip {
        font-size: 12px;
        padding: 7px 13px;
    }
}

/* ============================================================
   Sidebar 共用樣式
   ============================================================ */
.articles-sidebar-card {
    background: white;
    border-radius: 16px;
    border: 1px solid rgba(170,145,119,0.2);
    border-top: 4px solid #AA9177;
    box-shadow: 0 4px 20px rgba(170,145,119,0.08);
    padding: 24px;
    top: 100px;
    z-index: 900;
}

.sidebar-section { margin-bottom: 4px; }

.sidebar-section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 14px;
}

.sidebar-divider {
    border-color: var(--border-color, #e8e0d8);
    margin: 16px 0;
}

/* 桌機：垂直列表 */
.sidebar-article-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.sidebar-article-item {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: opacity 0.2s;
}
.sidebar-article-item:hover { opacity: 0.75; }

.sidebar-article-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.sidebar-article-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-article-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
}

.sidebar-article-meta {
    font-size: 12px;
    color: var(--text-muted, #999);
}

/* 文章分類列表 */
.sidebar-categories-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-category-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(170, 145, 119, 0.05);
    border: 1px solid var(--border-color, #e8e0d8);
    color: var(--text-main);
    font-size: 13px;
    min-height: 44px;
    transition: background 0.15s;
}
.sidebar-category-link:hover {
    background: rgba(170, 145, 119, 0.12);
    color: var(--articles-primary, #AA9177);
}

/* ============================================================
   手機版 Sidebar（< lg = 992px）
   ============================================================ */
@media (max-width: 991px) {
    /* 移除卡片外框，變成平面區塊 */
    .articles-sidebar-card {
        box-shadow: none;
        border-radius: 0;
        border-left: none;
        border-right: none;
        border-top: 1px solid var(--border-color, #e8e0d8);
        border-bottom: none;
        padding: 20px 16px;
        margin: 0 -12px; /* 撐滿容器寬度 */
    }

    /* 橫向滑動卡片列 */
    .sidebar-article-list {
        flex-direction: row;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 12px;
        padding-bottom: 4px;
    }
    .sidebar-article-list::-webkit-scrollbar { display: none; }

    /* 手機版：直立卡片（圖上字下） */
    .sidebar-article-item {
        flex-direction: column;
        flex: 0 0 130px;
        align-items: flex-start;
        gap: 8px;
        background: var(--bg-card, #fafafa);
        border: 1px solid var(--border-color, #e8e0d8);
        border-radius: 12px;
        padding: 10px;
    }
    .sidebar-article-item:hover { opacity: 1; background: rgba(170, 145, 119, 0.06); }

    .sidebar-article-thumb {
        width: 100%;
        height: 90px;
        border-radius: 8px;
    }

    .sidebar-article-title {
        font-size: 12px;
        -webkit-line-clamp: 3;
    }

    /* 手機隱藏分類（主內容已有 chips） */
    .sidebar-categories-divider,
    .sidebar-categories-section { display: none; }
}
