/* ============================================================
   SMC Timeline 年表 - 響應式樣式
   混合直條（手機）和橫向（桌面）設計
============================================================ */

/* 基礎容器 */
.smc-timeline-wrapper {
    width: 100%;
    max-width: 100%;
    padding: 0;
    margin: 0 auto;
}

.smc-timeline-wrapper * {
    box-sizing: border-box;
}

/* ============================================================
   載入狀態
============================================================ */
.smc-timeline-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.smc-timeline-loader .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #333;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.smc-timeline-loader p {
    color: #666;
    font-size: 14px;
    margin: 0;
}

/* 隱藏載入器 */
.smc-timeline-wrapper.loaded .smc-timeline-loader {
    display: none;
}

/* ============================================================
   篩選器
============================================================ */
.smc-timeline-filters {
    display: flex;
    gap: 15px;
    padding: 20px;
    background: #f9f9f9;
    border-bottom: 1px solid #e0e0e0;
    flex-wrap: wrap;
    align-items: center;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

.smc-timeline-search,
.smc-timeline-category-filter {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    transition: border-color 0.3s ease;
}

.smc-timeline-search:focus,
.smc-timeline-category-filter:focus {
    outline: none;
    border-color: #333;
    box-shadow: 0 0 0 3px rgba(51, 51, 51, 0.1);
}

.smc-timeline-clear-filters {
    padding: 10px 20px;
    background: #e0e0e0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.3s ease;
    width: 100%;
}

.smc-timeline-clear-filters:hover {
    background: #d0d0d0;
}

/* 手機版篩選 */
@media (max-width: 767px) {
    .smc-timeline-filters {
        flex-direction: column;
    }
    
    .filter-group {
        width: 100%;
        min-width: auto;
    }
}

/* ============================================================
   時間軸容器
============================================================ */
.smc-timeline-container {
    position: relative;
    width: 100%;
    padding: 40px 20px;
}

/* ============================================================
   橫向軸線（桌面版）
============================================================ */
.smc-timeline-axis {
    position: relative;
    height: 80px;
    margin-bottom: 60px;
    padding: 0 20px;
    display: none; /* 默認隱藏 */
}

.smc-timeline-axis.active {
    display: block;
}

.smc-timeline-line {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(to right, #ccc, #999, #ccc);
    transform: translateY(-50%);
}

.smc-timeline-marks {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
}

.smc-timeline-mark {
    position: relative;
    flex-shrink: 0;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s ease;
}

.smc-timeline-mark::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    background: white;
    border: 3px solid #333;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.smc-timeline-mark:hover::before {
    width: 18px;
    height: 18px;
    border-width: 2px;
    background: #333;
}

.smc-timeline-mark .year {
    position: absolute;
    top: 110%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    margin-top: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.smc-timeline-mark:hover .year {
    opacity: 1;
}

/* ============================================================
   卡片容器
============================================================ */
.smc-timeline-cards {
    display: grid;
    gap: 30px;
    position: relative;
}

/* 桌面版：多列佈局 */
@media (min-width: 1024px) {
    .smc-timeline-cards {
        grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    }
}

/* 平板版 */
@media (min-width: 768px) and (max-width: 1023px) {
    .smc-timeline-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 手機版：單列 */
@media (max-width: 767px) {
    .smc-timeline-cards {
        grid-template-columns: 1fr;
    }
}

/* 直條模式 */
.smc-timeline-wrapper.vertical .smc-timeline-cards {
    grid-template-columns: 1fr;
}

/* ============================================================
   時間軸卡片
============================================================ */
.smc-timeline-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    transform: translateY(20px);
    animation: slideInUp 0.6s ease-out forwards;
    position: relative;
}

@keyframes slideInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 分步動畫延遲 */
.smc-timeline-card:nth-child(1) { animation-delay: 0.05s; }
.smc-timeline-card:nth-child(2) { animation-delay: 0.1s; }
.smc-timeline-card:nth-child(3) { animation-delay: 0.15s; }
.smc-timeline-card:nth-child(4) { animation-delay: 0.2s; }
.smc-timeline-card:nth-child(5) { animation-delay: 0.25s; }
.smc-timeline-card:nth-child(n+6) { animation-delay: 0.3s; }

/* 卡片懸停效果 */
.smc-timeline-card:hover {
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
    border-color: #999;
    transform: translateY(-8px);
}

.smc-timeline-card.active {
    border-color: #333;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
}

/* ============================================================
   卡片年份標籤
============================================================ */
.smc-timeline-year {
    position: absolute;
    top: 0;
    right: 0;
    background: #333;
    color: white;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
    z-index: 10;
}

.smc-timeline-card:hover .smc-timeline-year {
    background: #555;
}

/* ============================================================
   卡片內容
============================================================ */
.smc-timeline-content {
    padding: 20px;
    position: relative;
}

.smc-timeline-content h3 {
    font-weight: 700;
    color: #333;
    line-height: 1.4;
}

.smc-timeline-content p {
    margin: 0 0 15px 0;
    color: #666;
    line-height: 1.6;
}

.smc-timeline-content p:last-of-type {
    margin-bottom: 0;
}

.smc-timeline-description{margin: unset !important;}

/* ============================================================
   卡片圖片和影片
============================================================ */
.smc-timeline-card img {
    width: 100%;
    height: auto;
    display: block;
}

.smc-timeline-card iframe {
    width: 100%;
    height: 300px;
    margin-top: 15px;
    border: none;
    border-radius: 4px;
}

@media (max-width: 767px) {
    .smc-timeline-card iframe {
        height: 200px;
    }
}

/* ============================================================
   分類標籤
============================================================ */
.smc-timeline-categories {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 0.1px solid var(--border-color);
}

.smc-timeline-category-tag {
    display: inline-block;
    background: #f0f0f0;
    color: #333;
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

.smc-timeline-category-tag:hover {
    background: #333;
    color: white;
    cursor: pointer;
}

/* ============================================================
   空白狀態
============================================================ */
.smc-timeline-empty {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.smc-timeline-empty svg {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.smc-timeline-empty p {
    font-size: 16px;
    margin: 0;
}

/* ============================================================
   錯誤狀態
============================================================ */
.smc-timeline-error {
    background: #fee;
    border: 1px solid #fcc;
    border-radius: 4px;
    padding: 20px;
    color: #c33;
    text-align: center;
    font-size: 14px;
}

/* ============================================================
   響應式調整
============================================================ */

/* 平板豎屏 */
@media (min-width: 576px) and (max-width: 767px) {
    .smc-timeline-container {
        padding: 30px 15px;
    }
    
    .smc-timeline-content {
        padding: 20px;
    }
}

/* 手機 */
@media (max-width: 575px) {
    .smc-timeline-container {
        padding: 20px 10px;
    }
    
    .smc-timeline-content {
        padding: 20px;
    }
    
    .smc-timeline-content h3 {
    }
    
    .smc-timeline-year {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .smc-timeline-filters {
        padding: 15px;
    }
}

/* ============================================================
   在模態視窗中的調整
============================================================ */
.modal .smc-timeline-wrapper,
.smc-modal .smc-timeline-wrapper {
    padding: 0;
}

.modal .smc-timeline-axis,
.smc-modal .smc-timeline-axis {
    display: none !important; /* 模態中總是用直條 */
}

.modal .smc-timeline-cards,
.smc-modal .smc-timeline-cards {
    grid-template-columns: 1fr;
}

/* ============================================================
   深色模式支持（可選）
============================================================ */
@media (prefers-color-scheme: dark) {
    .smc-timeline-wrapper {
        --bg-primary: #1a1a1a;
        --bg-secondary: #2d2d2d;
        --text-primary: #e0e0e0;
        --text-secondary: #a0a0a0;
        --border-color: #444;
    }
    
    .smc-timeline-card {
        background: var(--bg-secondary);
        border-color: var(--border-color);
    }
    
    .smc-timeline-content h3 {
        color: var(--text-primary);
    }
    
    .smc-timeline-content p {
        color: var(--text-secondary);
    }
    
    .smc-timeline-search,
    .smc-timeline-category-filter {
        background: var(--bg-secondary);
        border-color: var(--border-color);
        color: var(--text-primary);
    }
    
    .smc-timeline-filters {
        background: var(--bg-secondary);
        border-color: var(--border-color);
    }
}

/* ============================================================
   列印樣式
============================================================ */
@media print {
    .smc-timeline-filters,
    .smc-timeline-axis {
        display: none;
    }
    
    .smc-timeline-cards {
        grid-template-columns: 1fr;
    }
    
    .smc-timeline-card {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #999;
    }
}