/* ============================================================
   about_history.css - 發展歷程獨立樣式 (左右交錯，文字靠左)
   ============================================================ */

/* ============================================================
   頁面容器 - 移除 max-width 限制
   ============================================================ */
.about-history-page .main-content {
    height: auto;
    min-height: 80vh;
    padding-bottom: 2rem;
    max-width: none !important;
    width: 100%;
    padding-left: 0;
    padding-right: 0;
	overflow-y: visible;
    flex: 1;
}

.about-history-page .section-history {
    padding: 0.5rem 0;
}

/* ============================================================
   頁面標題
   ============================================================ */
.page-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 16px;
    background: linear-gradient(135deg, #1a3c5e, #2a5f8a);
    color: white;
    border-radius: 30px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.section-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #0f263b;
    letter-spacing: 1px;
}

.section-divider {
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, #1a3c5e, #6f8aa3);
    margin: 0.5rem auto 0.8rem;
    border-radius: 4px;
}

.section-header {
    text-align: center;
    margin-bottom: 1.5rem;
    padding: 0 2rem;
}

.section-hint {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-top: 4px;
}

.section-hint i {
    margin-right: 4px;
}

/* ============================================================
   直向時間線 - 中央對齊，左右交錯
   ============================================================ */
.history-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 20px 0;
    position: relative;
    max-width: 1500px;
    margin: 0 auto;
    width: 100%;
}

/* 垂直主幹線 - 中央 */
.history-timeline::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    background: linear-gradient(to bottom, #1a3c5e, #4a7a9c, #6f8aa3);
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(26, 60, 94, 0.15);
}

/* ============================================================
   時間軸項目
   ============================================================ */
.timeline-item {
    display: flex;
    align-items: flex-start;
    padding: 0 0 30px 0;
    position: relative;
    width: 100%;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

/* 圓點 - 在中央主幹線上 */
.timeline-item::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 6px;
    transform: translateX(-50%);
    width: 18px;
    height: 18px;
    background: #1a3c5e;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 0 0 3px #1a3c5e, 0 4px 12px rgba(26, 60, 94, 0.3);
    z-index: 5;
    flex-shrink: 0;
}

/* ============================================================
   內容包裝器 - 統一靠主幹線
   ============================================================ */
.timeline-content-wrapper {
    display: flex;
    flex-direction: column;
    width: 50%;
}

/* 奇數項目 - 在左側，緊靠主幹線 */
.timeline-item:nth-child(odd) .timeline-content-wrapper {
    margin-right: auto;
    margin-left: 0;
    padding-right: 20px;
    text-align: left;
    align-items: flex-end;
}

/* 偶數項目 - 在右側，緊靠主幹線 */
.timeline-item:nth-child(even) .timeline-content-wrapper {
    margin-left: auto;
    margin-right: 0;
    padding-left: 20px;
    text-align: left;
    align-items: flex-start;
}

/* ============================================================
   年份標記 - 緊靠主幹線
   ============================================================ */
.timeline-year {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
}

/* 奇數項目 - 年份在左側，靠右對齊（緊靠主幹線） */
.timeline-item:nth-child(odd) .timeline-year {
    justify-content: flex-end;
    padding-right: 0;
}

/* 偶數項目 - 年份在右側，靠左對齊（緊靠主幹線） */
.timeline-item:nth-child(even) .timeline-year {
    justify-content: flex-start;
    padding-left: 0;
}

.timeline-year .year-text {
    font-size: 1.5rem;
    font-weight: 900;
    color: #1a3c5e;
    padding: 3px 16px;
    background: white;
    border-radius: 24px;
    border: 2.5px solid #1a3c5e;
    display: inline-block;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* ============================================================
   內容卡片
   ============================================================ */
.timeline-content {
    flex: 1;
    min-width: 0;
    width: 100%;
}

/* 奇數項目 - 卡片在左側 */
.timeline-item:nth-child(odd) .timeline-content {
    text-align: left;
}

/* 偶數項目 - 卡片在右側 */
.timeline-item:nth-child(even) .timeline-content {
    text-align: left;
}

.node-content {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    background: white;
    padding: 16px 20px;
    border-radius: 14px;
    border: 1.5px solid #e6edf5;
    box-shadow: 0 4px 16px rgba(0,0,0,0.04);
    transition: all 0.4s ease;
    cursor: pointer;
    position: relative;
    opacity: 0;
    transform: translateX(20px);
    text-align: left;
}

.node-content.visible {
    opacity: 1;
    transform: translateX(0);
}

.node-content:hover {
    border-color: #1a3c5e;
    box-shadow: 0 8px 35px rgba(26, 60, 94, 0.15);
}

/* 奇數項目 - 懸停向左滑 */
.timeline-item:nth-child(odd) .node-content:hover {
    transform: translateX(-6px);
}

/* 偶數項目 - 懸停向右滑 */
.timeline-item:nth-child(even) .node-content:hover {
    transform: translateX(6px);
}

.node-content .node-expand {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    color: #94a3b8;
    margin-top: 4px;
    transition: all 0.3s;
    text-align: left;
}

.node-content:hover .node-expand {
    color: #1a3c5e;
}

.node-content:hover .node-expand i {
    transform: scale(1.1);
}

.node-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f4fa;
    border-radius: 50%;
    font-size: 1.2rem;
    color: #1a3c5e;
    transition: all 0.3s;
}

.node-content:hover .node-icon {
    background: #1a3c5e;
    color: white;
    transform: rotate(-10deg) scale(1.1);
}

.node-info {
    flex: 1;
    min-width: 0;
    text-align: left;
}

.node-info h4 {
    font-size: 1.2rem;
    color: #0f263b;
    font-weight: 700;
    margin-bottom: 4px;
    line-height: 1.3;
    text-align: left;
}

.node-info p {
    font-size: 0.95rem;
    color: #475569;
    line-height: 1.6;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-align: left;
}

/* ============================================================
   所有卡片圖示在左，文字在右
   ============================================================ */
.timeline-item:nth-child(odd) .node-icon,
.timeline-item:nth-child(even) .node-icon {
    order: 1;
}

.timeline-item:nth-child(odd) .node-info,
.timeline-item:nth-child(even) .node-info {
    order: 2;
}

/* ============================================================
   彈窗遮罩
   ============================================================ */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    animation: modalFadeIn 0.3s ease;
}

.modal-overlay.active {
    display: flex;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: white;
    border-radius: 20px;
    max-width: 560px;
    width: 90%;
    padding: 40px 36px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideUp 0.4s ease;
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.3s;
    padding: 4px 8px;
    border-radius: 8px;
    z-index: 10;
}

.modal-close:hover {
    color: #1a3c5e;
    background: #f0f4fa;
    transform: rotate(90deg);
}

.modal-body {
    text-align: left;
}

.modal-year {
    display: inline-block;
    font-size: 2.5rem;
    font-weight: 900;
    color: #1a3c5e;
    background: #f0f4fa;
    padding: 4px 24px;
    border-radius: 30px;
    margin-bottom: 16px;
    text-align: left;
}

.modal-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: #0f263b;
    margin-bottom: 16px;
    text-align: left;
}

.modal-full {
    font-size: 1rem;
    color: #475569;
    line-height: 1.8;
    margin-bottom: 20px;
    text-align: left;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ============================================================
   響應式設計 - 手機版改為單側時間線
   ============================================================ */
@media (max-width: 768px) {
    /* 時間線主幹線移至左側 */
	
	.about-history-page .section-history {
		padding-bottom: 6rem;
	}
	
    .history-timeline::before {
        left: 18px;
    }

    .timeline-item::before {
        left: 18px;
        width: 14px;
        height: 14px;
        top: 8px;
    }

    /* 所有項目統一靠左 */
    .timeline-item:nth-child(odd) .timeline-content-wrapper,
    .timeline-item:nth-child(even) .timeline-content-wrapper {
        margin: 0;
        padding-left: 44px;
        padding-right: 12px;
        width: 100%;
        max-width: 100%;
        text-align: left;
        align-items: flex-start;
        box-sizing: border-box;
    }

    /* 年份標記靠左 */
    .timeline-item:nth-child(odd) .timeline-year,
    .timeline-item:nth-child(even) .timeline-year {
        justify-content: flex-start;
        padding-left: 0;
    }

    .timeline-year .year-text {
        font-size: 1.1rem;
        padding: 2px 14px;
    }

    .timeline-content {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    /* ⭐ 核心修正：卡片容器 */
    .node-content {
        display: flex;
        align-items: flex-start;
        gap: 10px;
        padding: 14px 16px;
        border-radius: 12px;
        background: white;
        border: 1.5px solid #e6edf5;
        box-shadow: 0 4px 16px rgba(0,0,0,0.04);
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow: hidden;
        cursor: pointer;
        transition: all 0.3s ease;
    }

    /* 圖示 - 固定尺寸不壓縮 */
    .node-icon {
        flex: 0 0 34px;
        width: 34px;
        height: 34px;
        min-width: 34px;
        font-size: 1rem;
        display: flex;
        align-items: center;
        justify-content: center;
        background: #f0f4fa;
        border-radius: 50%;
        color: #1a3c5e;
    }

    /* ⭐ 核心修正：文字區域 - 使用 min-width:0 允許收縮 */
    .node-info {
        flex: 1 1 0;
        min-width: 0;
        max-width: 100%;
        overflow: hidden;
        box-sizing: border-box;
    }

    /* 所有文字強制換行 */
    .node-info *,
    .node-info {
        word-wrap: break-word !important;
        word-break: break-word !important;
        overflow-wrap: break-word !important;
        white-space: normal !important;
        max-width: 100% !important;
    }

    .node-info h4 {
        font-size: 0.95rem;
        font-weight: 700;
        color: #0f263b;
        line-height: 1.4;
        margin-bottom: 3px;
        text-align: left;
    }

    .node-info p {
        font-size: 0.82rem;
        color: #475569;
        line-height: 1.5;
        margin-bottom: 4px;
        text-align: left;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    /* 展開按鈕 */
    .node-expand {
        font-size: 0.7rem !important;
        color: #94a3b8;
        display: inline-flex;
        align-items: center;
        gap: 4px;
        flex-shrink: 0;
        white-space: nowrap;
        margin-top: 2px;
        transition: color 0.3s;
    }

    .node-content:hover .node-expand {
        color: #1a3c5e;
    }

    /* 懸停效果調整 */
    .timeline-item:nth-child(odd) .node-content:hover,
    .timeline-item:nth-child(even) .node-content:hover {
        transform: translateX(4px);
        border-color: #1a3c5e;
        box-shadow: 0 6px 24px rgba(26, 60, 94, 0.12);
    }

    /* 移除左右交錯的懸停平移 */
    .timeline-item:nth-child(odd) .node-content:hover,
    .timeline-item:nth-child(even) .node-content:hover {
        transform: translateX(4px);
    }

    /* 彈窗手機版調整 */
    .modal-content {
        padding: 30px 24px;
        max-width: 95%;
    }

    .modal-year {
        font-size: 1.8rem;
        padding: 2px 18px;
    }

    .modal-title {
        font-size: 1.3rem;
    }

    .modal-full {
        font-size: 0.92rem;
    }
}

/* 小手機 (480px 以下) */
@media (max-width: 480px) {
    .timeline-item:nth-child(odd) .timeline-content-wrapper,
    .timeline-item:nth-child(even) .timeline-content-wrapper {
        padding-left: 38px;
        padding-right: 8px;
    }

    .node-content {
        padding: 12px 12px;
        gap: 8px;
    }

    .node-icon {
        flex: 0 0 28px;
        width: 28px;
        height: 28px;
        min-width: 28px;
        font-size: 0.85rem;
    }

    .node-info h4 {
        font-size: 0.85rem;
    }

    .node-info p {
        font-size: 0.75rem;
        -webkit-line-clamp: 2;
    }

    .node-expand {
        font-size: 0.6rem !important;
    }

    .timeline-year .year-text {
        font-size: 0.95rem;
        padding: 2px 12px;
    }

    .history-timeline::before {
        left: 14px;
    }

    .timeline-item::before {
        left: 14px;
        width: 12px;
        height: 12px;
        top: 6px;
    }

    .modal-content {
        padding: 24px 18px;
    }

    .modal-year {
        font-size: 1.5rem;
    }

    .modal-title {
        font-size: 1.1rem;
    }

    .modal-full {
        font-size: 0.85rem;
    }
}