/* 워드클라우드 스타일 - 완전히 개선된 버전 */
.wordcloud-section {
    background-color: #f9f9f9;
    padding: 40px 0 60px;
    position: relative;
    overflow: hidden;
}

.wordcloud-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(to right, #4dabf7, #74c0fc, #a5d8ff);
}

.wordcloud-section .inner {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
}

/* 워드클라우드 컨트롤 */
.wordcloud-controls {
    margin-bottom: 15px;
    text-align: center;
}

.controls-inner {
    display: inline-flex;
    background: #fff;
    border-radius: 30px;
    padding: 5px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-top: 10px;
    align-items: center;
}

.control-btn {
    background: none;
    border: none;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #495057;
}

.control-btn:hover {
    color: #4dabf7;
    background-color: #f1f5ff;
}

.control-btn.active {
    background-color: #4dabf7;
    color: white;
    font-weight: 500;
    box-shadow: 0 2px 5px rgba(77, 171, 247, 0.3);
}

/* 도움말 아이콘 스타일 */
.help-icon {
    margin-left: 10px;
    color: #4dabf7;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.help-icon:hover {
    color: #2a80c8;
}

#help-tooltip {
    position: absolute;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 14px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
    z-index: 100;
    color: #333;
    max-width: 300px;
    transition: opacity 0.2s ease;
}

/* 워드클라우드 컨테이너 */
#wordcloud-container {
    width: 100%;
    height: 500px;
    margin-top: 15px;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    overflow: hidden;
    position: relative;
    transition: all 0.3s ease;
    padding: 10px;
}

#wordcloud-container:hover {
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}

.wordcloud-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #777;
    font-size: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.wordcloud-loading i {
    font-size: 24px;
    color: #4dabf7;
    animation: spin 1.5s infinite ease-in-out;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.wordcloud-svg text {
    transition: all 0.3s ease;
}

.error-message {
    padding: 20px;
    color: #d9534f;
    text-align: center;
    font-size: 16px;
    background-color: #fff5f5;
    border-radius: 8px;
    margin: 20px 0;
    border-left: 4px solid #d9534f;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.error-message i {
    font-size: 20px;
    color: #d9534f;
}

/* 워드클라우드 오버레이 스타일 */
.wordcloud-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    pointer-events: none; /* 클릭 이벤트가 워드클라우드에 전달되도록 함 */
    z-index: 1;
}

/* 워드클라우드 중앙 제목 스타일 */
.cloud-title {
    font-size: 24px;
    font-weight: bold;
    color: rgba(13, 71, 161, 0.8);
    text-align: center;
    margin-bottom: 220px; /* 타이틀과 버튼 사이 간격 */
    background-color: rgba(255, 255, 255, 0.7);
    padding: 8px 20px;
    border-radius: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    text-shadow: 0 1px 2px rgba(255,255,255,0.5);
}

/* 논문 보러가기 버튼 스타일 */
.cloud-button {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 500;
    color: white !important;
    background-color: #4285f4;
    padding: 10px 25px;
    border-radius: 30px;
    text-decoration: none;
    box-shadow: 0 3px 10px rgba(66, 133, 244, 0.4);
    transition: all 0.3s ease;
    pointer-events: auto; /* 버튼은 클릭 가능하게 설정 */
}

.cloud-button:hover {
    background-color: #3367d6;
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.5);
    transform: translateX(-50%) translateY(-2px);
    color: white !important;
    text-decoration: none;
}

.cloud-button i {
    margin-left: 6px;
    font-size: 14px;
}

/* 워드클라우드 툴팁 스타일 */
#wordcloud-tooltip {
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    border: none;
    border-radius: 8px;
    font-family: 'Nanum Gothic', sans-serif;
}

/* 키워드 통계 컨테이너 */
#keyword-stats-container {
    display: none;
    position: fixed;
    z-index: 1000;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.5);
    overflow-y: auto;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.keyword-stats-card {
    max-width: 800px;
    margin: 50px auto;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
    overflow: hidden;
    animation: slide-up 0.4s ease-out;
}

@keyframes slide-up {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.keyword-stats-card .card-header {
    background: linear-gradient(135deg, #4dabf7, #74c0fc);
    color: #fff;
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.keyword-stats-card .card-header h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.keyword-stats-card .close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.keyword-stats-card .close-btn:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: rotate(90deg);
}

.keyword-stats-card .card-body {
    padding: 24px;
}

.stats-summary {
    display: flex;
    margin-bottom: 25px;
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
}

.stat-item {
    flex: 1;
    text-align: center;
    padding: 10px;
}

.stat-value {
    font-size: 28px;
    font-weight: bold;
    color: #4dabf7;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 14px;
    color: #6c757d;
}

.related-content h4 {
    font-size: 20px;
    margin-bottom: 20px;
    color: #333;
    position: relative;
    padding-bottom: 10px;
}

.related-content h4::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 3px;
    background-color: #4dabf7;
}

.related-papers {
    list-style: none;
    padding: 0;
    margin: 0;
}

.paper-item {
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.paper-item.visible {
    opacity: 1;
    transform: translateY(0);
}

.paper-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.paper-link {
    display: block;
    color: #333;
    text-decoration: none;
    transition: all 0.2s;
    padding: 10px;
    border-radius: 8px;
}

.paper-link:hover {
    color: #4dabf7;
    background-color: #f8f9fa;
}

.paper-link h4 {
    font-size: 18px;
    margin: 0 0 10px;
    color: #333;
    transition: all 0.2s;
    position: relative;
    padding-bottom: 0;
}

.paper-link:hover h4 {
    color: #4dabf7;
}

.paper-link h4::after {
    display: none;
}

.excerpt {
    font-size: 14px;
    color: #666;
    margin: 0 0 12px;
    line-height: 1.6;
}

.meta {
    display: flex;
    flex-wrap: wrap;
    font-size: 12px;
    color: #999;
    gap: 15px;
}

.meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.meta .views {
    margin-left: auto;
}

.no-results {
    padding: 30px;
    text-align: center;
    color: #999;
    background-color: #f9f9f9;
    border-radius: 8px;
    font-size: 15px;
}

.loading {
    text-align: center;
    padding: 50px;
    color: #777;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.loading i {
    font-size: 24px;
    color: #4dabf7;
    animation: spin 1.5s infinite ease-in-out;
}

/* 타이틀 스타일 보완 */
.wordcloud-section .titBox {
    margin-bottom: 15px;
}

.wordcloud-section .titBox .tit {
    font-size: 28px;
    font-weight: bold;
    color: #333;
    position: relative;
    display: inline-block;
}

.wordcloud-section .titBox .tit:after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 40px;
    height: 3px;
    background-color: #4285f4;
}

/* 반응형 처리 */
@media (max-width: 768px) {
    .stats-summary {
        flex-direction: column;
    }
    
    .stat-item {
        margin-bottom: 15px;
    }
    
    .keyword-stats-card {
        margin: 20px auto;
    }
    
    .meta {
        flex-direction: column;
        gap: 8px;
    }
    
    .meta .views {
        margin-left: 0;
    }
    
    #wordcloud-container {
        height: 400px;
    }
    
    .cloud-title {
        font-size: 18px;
        margin-bottom: 160px;
    }
    
    .cloud-button {
        font-size: 14px;
        padding: 8px 20px;
    }
}

/* 논문 보러가기 버튼 스타일 */
.button-container {
    text-align: center;
    margin-top: 20px;
    margin-bottom: 20px;
}

.paper-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 500;
    color: white !important;
    background-color: #4285f4;
    padding: 10px 25px;
    border-radius: 30px;
    text-decoration: none;
    box-shadow: 0 3px 10px rgba(66, 133, 244, 0.4);
    transition: all 0.3s ease;
}

.paper-button:hover {
    background-color: #3367d6;
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.5);
    transform: translateY(-2px);
    color: white !important;
    text-decoration: none;
}

.paper-button i {
    margin-left: 6px;
    font-size: 14px;
}

.wordcloud-section .titBox .tit:after {
    display: none; /* 파란 밑줄 숨기기 */
}

