/* ===== 역사 인물 타임라인 섹션 ===== */
.timeline-section {
    padding: 16px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
    overflow: hidden;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.timeline-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.timeline-title .material-symbols-outlined {
    color: var(--primary);
    font-size: 20px;
}

.timeline-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 16px;
    border: 1px solid var(--border-light);
    background: var(--bg-section);
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.timeline-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.timeline-toggle .material-symbols-outlined {
    font-size: 16px;
    transition: transform 0.3s;
}

.timeline-section.collapsed .timeline-toggle .material-symbols-outlined {
    transform: rotate(180deg);
}

/* 타임라인 컨테이너 */
.timeline-container {
    position: relative;
    overflow-x: auto;
    overflow-y: visible;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) var(--bg-section);
    padding-bottom: 8px;
}

.timeline-container::-webkit-scrollbar {
    height: 6px;
}

.timeline-container::-webkit-scrollbar-track {
    background: var(--bg-section);
    border-radius: 3px;
}

.timeline-container::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

/* 타임라인 래퍼 */
.timeline-wrapper {
    display: flex;
    flex-direction: column;
    min-width: max-content;
    padding: 0 8px;
}

/* 시대 탭 영역 */
.timeline-eras {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}

.timeline-era-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 16px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.08) 0%, rgba(236, 72, 153, 0.04) 100%);
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    min-width: 100px;
}

.timeline-era-tab:hover {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.12) 0%, rgba(236, 72, 153, 0.08) 100%);
}

.timeline-era-tab.active {
    background: var(--primary-gradient);
    border-color: transparent;
}

.timeline-era-tab.active .era-name,
.timeline-era-tab.active .era-period,
.timeline-era-tab.active .era-count {
    color: white;
}

.era-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.era-period {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.era-count {
    font-size: 0.7rem;
    color: var(--primary);
    font-weight: 600;
}

/* 타임라인 메인 트랙 */
.timeline-track {
    position: relative;
    padding: 20px 0 48px;
    min-height: 160px;
}

/* 타임라인 선 */
.timeline-line {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg,
        rgba(139, 92, 246, 0.2) 0%,
        var(--primary) 15%,
        var(--secondary) 50%,
        var(--primary) 85%,
        rgba(139, 92, 246, 0.2) 100%
    );
    border-radius: 2px;
}

/* 타임라인 인물들 컨테이너 */
.timeline-figures {
    display: flex;
    position: relative;
    gap: 8px;
    padding: 0 16px;
}

/* 시대 구분 그룹 */
.timeline-era-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    margin-right: 16px;
}

.timeline-era-group:last-child {
    margin-right: 0;
}

.timeline-era-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--primary);
    background: var(--bg-card);
    padding: 4px 12px;
    border-radius: 12px;
    margin-bottom: 12px;
    border: 1px solid var(--border-card);
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.1);
}

.timeline-era-figures {
    display: flex;
    gap: 12px;
}

/* 인물 노드 */
.timeline-figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s;
    position: relative;
    padding-bottom: 28px;
}

.timeline-figure:hover {
    transform: translateY(-4px);
}

/* 연결선 */
.timeline-figure::after {
    content: '';
    position: absolute;
    bottom: 6px;
    left: 50%;
    width: 2px;
    height: 22px;
    background: linear-gradient(to bottom, var(--primary), rgba(139, 92, 246, 0.3));
    transform: translateX(-50%);
}

/* 타임라인 포인트 */
.timeline-point {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 12px;
    height: 12px;
    background: var(--primary);
    border-radius: 50%;
    transform: translateX(-50%);
    border: 3px solid var(--bg-card);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.4);
    z-index: 5;
}

.timeline-figure.contemporary .timeline-point {
    background: var(--secondary);
    box-shadow: 0 2px 12px rgba(236, 72, 153, 0.5);
    animation: pulse-timeline 2s infinite;
}

@keyframes pulse-timeline {
    0%, 100% { box-shadow: 0 2px 8px rgba(236, 72, 153, 0.5); }
    50% { box-shadow: 0 2px 16px rgba(236, 72, 153, 0.7); }
}

/* 인물 썸네일 */
.timeline-thumb {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--bg-card);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(236, 72, 153, 0.1));
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 10;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.timeline-figure:hover .timeline-thumb {
    border-color: var(--primary);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.3);
}

.timeline-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.timeline-thumb-placeholder {
    font-size: 1.4rem;
}

.timeline-figure.contemporary .timeline-thumb {
    border-color: var(--secondary);
}

/* 인물 정보 */
.timeline-info {
    text-align: center;
    margin-top: 6px;
    max-width: 68px;
}

.timeline-name {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.timeline-dates {
    font-size: 0.55rem;
    color: var(--text-muted);
    white-space: nowrap;
    margin-top: 2px;
}

/* 동시대 인물 강조 */
.timeline-figure.contemporary .timeline-name {
    color: var(--secondary);
}

/* 동시대 뱃지 */
.contemporary-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 16px;
    height: 16px;
    background: var(--secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.5rem;
    color: white;
    font-weight: 700;
    border: 2px solid var(--bg-card);
    z-index: 15;
}

/* 타임라인 힌트 */
.timeline-hint {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
    font-size: 0.7rem;
    color: var(--text-muted);
}

.timeline-hint-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.timeline-hint-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.timeline-hint-dot.normal {
    background: var(--primary);
}

.timeline-hint-dot.contemporary {
    background: var(--secondary);
}

/* 스크롤 안내 */
.timeline-scroll-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 8px;
    opacity: 0.7;
}

.timeline-scroll-hint .material-symbols-outlined {
    font-size: 16px;
    animation: scroll-hint 1.5s ease-in-out infinite;
}

@keyframes scroll-hint {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(4px); }
}

/* 반응형 */
@media (max-width: 480px) {
    .timeline-thumb {
        width: 44px;
        height: 44px;
    }

    .timeline-thumb-placeholder {
        font-size: 1.1rem;
    }

    .timeline-info {
        max-width: 56px;
    }

    .timeline-name {
        font-size: 0.65rem;
    }

    .timeline-dates {
        font-size: 0.5rem;
    }

    .timeline-era-tab {
        min-width: 80px;
        padding: 8px 12px;
    }

    .era-name {
        font-size: 0.8rem;
    }

    .timeline-era-figures {
        gap: 10px;
    }
}

/* 타임라인 접힘 상태 */
.timeline-section.collapsed .timeline-container {
    display: none;
}

.timeline-section.collapsed .timeline-hint {
    display: none;
}

.timeline-section.collapsed .timeline-scroll-hint {
    display: none;
}
