/* 연구기관 목록 페이지 스타일 */

/* Leaflet 지도 컨테이너 */
.world-map-container {
    position: relative;
    width: 100%;
    height: 500px;
    margin-bottom: 20px;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    overflow: hidden;
}

#worldMap {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    z-index: 1;
}

#worldMapZoom {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    z-index: 1;
}

/* Leaflet 컨트롤 스타일 개선 */
.leaflet-container {
    font-family: inherit;
}

/* 지도 컨테이너 내부의 Leaflet 지도 요소 border-radius 일관성 유지 */
#worldMap .leaflet-container,
#worldMapZoom .leaflet-container,
#continentMapZoom .leaflet-container {
    border-radius: 8px;
}

.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.3);
}

.leaflet-popup-content {
    margin: 12px;
    line-height: 1.5;
}

/* Leaflet 마커 커스텀 스타일 */
.custom-marker {
    background-color: #FF6B35;
    border: 2px solid #fff;
    border-radius: 50%;
    width: 12px;
    height: 12px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* 대륙 버튼 스타일 (Leaflet 지도 위) */
.continent-button {
    position: absolute !important;
    padding: 8px 16px;
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.85);
    color: #333;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, z-index 0s, background 0.3s ease, box-shadow 0.3s ease !important; /* left, top은 transition 제외 */
    z-index: 1000 !important;
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    transform-origin: center center !important; /* transform 기준점 명시 */
    /* transform은 inline style로 설정되므로 여기서는 기본값만 지정 */
}

/* hover 시 스타일 변경 (transform은 JavaScript에서 관리하므로 여기서는 제거) */
.continent-button:hover,
#continentMap .continent-button:hover,
.world-map-container .continent-button:hover {
    background: rgba(255, 255, 255, 0.95) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
    /* transform과 z-index는 JavaScript에서 관리하여 위치 변경 방지 */
}

.continent-button .count {
    display: inline-block;
    margin-left: 5px;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.1);
    font-size: 12px;
}

/* 줌 레벨 표시 컨트롤 스타일 */
.leaflet-zoom-level-control {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    padding: 5px 10px;
    font-size: 13px;
    font-weight: bold;
    color: #333;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}

.leaflet-zoom-level-control .zoom-level-label {
    color: #666;
    margin-right: 5px;
}

.leaflet-zoom-level-control .zoom-level-value {
    color: #1a73e8;
    font-weight: bold;
    min-width: 20px;
    display: inline-block;
    text-align: center;
}

/* 국가 버튼 스타일 (대륙 버튼과 동일한 디자인) */
.country-button {
    position: absolute;
    padding: 8px 16px;
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.85);
    color: #333;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    z-index: 1000;
    backdrop-filter: blur(5px);
    white-space: nowrap;
}

.country-button:hover {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transform: translate(-50%, -50%) scale(1.05);
}

.country-button .count {
    display: inline-block;
    margin-left: 5px;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.1);
    font-size: 12px;
}

/* 확대 지도에서 국가 버튼 크기 축소 */
#continentMapZoom .country-button {
    padding: 0px 6px;
    font-size: 11px;
    border-radius: 15px;
}

#continentMapZoom .country-button .count {
    padding: 1px 6px;
    font-size: 10px;
    margin-left: 4px;
}

#continentMapZoom .country-button:hover {
    transform: translate(-50%, -50%) scale(1.03);
}

/* 2열 분할 레이아웃 */
.split-view {
    display: none !important;
    width: 100%;
    height: 570px;
    margin: 20px 0;
}

.split-view.active {
    display: flex !important;
    gap: 20px;
}

.split-left {
    flex: 2;
    min-width: 60%;
    background: #f8f9fa;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.split-right {
    overflow-x: hidden !important;
    flex: 1;
    width: 400px;
    max-width: 400px;
    background: #ffffff;
    border-radius: 8px;
    padding: 20px;
    max-height: 650px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.split-right::-webkit-scrollbar {
    width: 8px;
}

.split-right::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.split-right::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.split-right::-webkit-scrollbar-thumb:hover {
    background: #555;
}

#continentMapZoom {
    width: 100%;
    height: 100%;
    position: relative;
    background: #ffffff;
    border: none; /* split-left의 border와 중복되므로 제거 */
    border-radius: 8px; /* split-left와 동일한 border-radius */
    overflow: hidden;
}

/* 연구기관 썸네일 그리드 (2열) */
.agency-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    overflow-y: auto;
    overflow-x: hidden !important;
    max-height: 500px;
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
}

.agency-grid::-webkit-scrollbar {
    width: 8px;
}

.agency-grid::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.agency-grid::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.agency-grid::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 더보기 버튼 스타일 */
.load-more-btn {
    margin-top: 15px;
    padding: 10px 20px;
    border: 2px solid #4A90E2;
    border-radius: 6px;
    background: transparent;
    color: #4A90E2;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    flex-shrink: 0;
}

.load-more-btn:hover {
    background: #4A90E2;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.load-more-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.load-more-btn:disabled:hover {
    background: transparent;
    color: #4A90E2;
    transform: none;
    box-shadow: none;
}

.agency-thumbnail-only {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: visible;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    padding: 10px;
    display: flex;
    flex-direction: column;
    position: relative;
    height: auto;
    min-width: 0;
    max-width: 95%;
    box-sizing: border-box;
}

.agency-thumbnail-only:hover {
    border-color: #4A90E2;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.2);
    transform: translateY(-2px);
}

.agency-thumbnail-only img {
    width: 100%;
    height: 70px;
    object-fit: contain;
    margin-bottom: 8px;
    max-width: 100%;
    display: block;
}

.agency-info-text {
    text-align: center;
    font-size: 12px;
    line-height: 1.4;
    min-width: 0;
    overflow: hidden;
    word-wrap: break-word;
}

.agency-info-text .country {
    color: #4A90E2;
    font-size: 11px;
    font-weight: normal;
    display: block;
    margin-bottom: 3px;
}

.agency-info-text .name {
    color: #333;
    font-size: 16px;
    font-weight: bold;
    display: block;
}

.agency-description-tooltip {
    display: none;
    position: fixed !important;
    background: #ffffff;
    color: #333;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.6;
    max-width: 320px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 999999 !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    border: 2px solid #4A90E2;
    pointer-events: none;
    word-break: keep-all;
}

.agency-description-tooltip .tooltip-agency-name {
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 8px;
    color: #183f7a;
}

.agency-description-tooltip .tooltip-divider {
    margin: 8px 0;
    border: none;
    border-top: 1px solid #ddd;
    height: 0;
}

.agency-description-tooltip .tooltip-description {
    color: #666;
    font-size: 13px;
    line-height: 1.6;
}

.agency-description-tooltip::-webkit-scrollbar {
    width: 6px;
}

.agency-description-tooltip::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.agency-description-tooltip::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.agency-description-tooltip::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 닫기 버튼 스타일 (더보기 버튼과 동일한 위치) */
.close-split-view-btn {
    margin-top: 15px;
    padding: 10px 20px;
    border: 2px solid #4A90E2;
    border-radius: 6px;
    background: transparent;
    color: #4A90E2;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    flex-shrink: 0;
}

.close-split-view-btn:hover {
    background: #4A90E2;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.close-split-view-btn:active {
    background: #3a7bc8;
}

.split-right h3 {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #4A90E2;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

/* 타이틀 화살표 스타일 (.location_area>li+li:before 참고) */
.split-right h3 .continent-title-item {
    position: relative;
}

.split-right h3 .continent-title-item + .continent-title-item {
    margin-left: 15rem;
    padding-left: 12rem;
}

.split-right h3 .continent-title-item + .continent-title-item:before {
    content: "";
    position: absolute;
    top: 50%;
    left: -7rem;
    width: 7rem;
    height: 7rem;
    border-top: 1px solid #666;
    border-right: 1px solid #666;
    transform: translateY(-50%) rotate(45deg);
}

/* 보기 모드 탭 스타일 */
.view-mode-tabs {
    display: flex;
    gap: 8px;
    white-space: nowrap;
}

.view-mode-tab {
    padding: 10px 25px;
    background: #f5f5f5;
    border: 2px solid #d0d0d0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    transition: all 0.3s ease;
}

.view-mode-tab:hover {
    background: #e8e8e8;
    color: #333;
    border-color: #999;
}

.view-mode-tab.active {
    background: #4A90E2;
    color: #ffffff;
    border-color: #4A90E2;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.3);
}

/* 페이지네이션 가운데 정렬 (전체보기 모드에서만 표시, JavaScript로 제어) */
.layout_list_paging .list_paging,
.layout_list_paging #paging {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

/* 모바일 환경 대응 */
@media screen and (max-width: 768px) {
    /* 지도 관련 요소 숨김 */
    #mapContainer {
        display: none !important;
    }

    .split-view {
        display: none !important;
    }

    /* 보기 모드 탭 숨김 */
    .view-mode-tabs-right {
        display: none !important;
    }

    /* 목록보기만 표시 */
    #listLine {
        display: block !important;
    }

    /* 모바일에서도 페이지네이션 가운데 정렬 */
    #paging {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 100% !important;
    }

    /* 탭 레이아웃 조정 */
    .info_cont_tab.type02 {
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .tab_style01 {
        flex-wrap: wrap;
        gap: 5px;
        width: 100%;
    }

    .tab_style01 li {
        font-size: 12px;
        flex: 0 0 auto;
    }

    .tab_style01 li a {
        padding: 8px 12px;
    }

    /* 검색 영역 조정 */
    .form_search_wrap table {
        display: block;
    }

    .form_search_wrap table tbody,
    .form_search_wrap table tr,
    .form_search_wrap table td {
        display: block;
        width: 100%;
    }

    .form_search_wrap table td {
        margin-bottom: 10px;
    }
}

