.header {
    z-index: 2;
}

#headerAddressInput {
    width: 100%;
}

/* header_search 부모 요소에 relative 추가 */
.header_search {
    position: relative;
}

/* 검색 결과 패널 */
.search-results-panel {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    min-width: 340px;
    background-color: #fff;
    border: 1px solid #e5e7eb;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 3;
}

.search-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid #e5e7eb;
    background-color: #f9fafb;
}

.search-results-header .result-count {
    font-size: 13px;
    font-weight: 500;
    color: #374151;
}

.search-results-header .krds-btn.icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 4px;
    background: #6b7280;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    color: #fff;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.search-results-header .krds-btn.icon:hover {
    background-color: #4b5563;
    color: #fff;
}

.search-results-header .krds-btn.icon .svg-icon {
    width: 16px;
    height: 16px;
}

/* 검색 결과 리스트 */
.search-results-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 300px;
    overflow-y: auto;
}

.search-result-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #e5e7eb;
    transition: background-color 0.15s ease;
    background-color: #fff;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover,
.search-result-item:focus,
.search-result-item.active {
    background-color: #f3f4f6;
    outline: none;
}

.search-result-item:hover .result-road,
.search-result-item:focus .result-road,
.search-result-item.active .result-road {
    color: #2563eb;
}

.search-result-item .result-road {
    font-size: 13px;
    font-weight: 500;
    color: #1f2937;
}

.search-result-item .result-jibun {
    font-size: 12px;
    color: #6b7280;
}

.search-result-item .result-category {
    display: inline-block;
    font-size: 11px;
    color: #2563eb;
    background: #eff6ff;
    padding: 2px 6px;
    border-radius: 4px;
}

/* 검색 결과 없음 */
.search-no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #6b7280;
    background-color: #fff;
}

.search-no-results .svg-icon {
    font-size: 24px;
    margin-bottom: 8px;
}

.search-no-results p {
    font-size: 13px;
    margin: 0;
}

/* 검색결과 페이징 */
.search-results-panel .krds-pagination {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px;
    border-top: 1px solid #e5e7eb;
    margin-top: unset !important;
}

.search-results-panel .krds-pagination .page-navi {
    display: inline-flex !important;
    font-size: 12px;
    padding: 4px 8px;
    color: #374151;
    text-decoration: none;
    cursor: pointer;
}

.search-results-panel .krds-pagination .page-navi:hover {
    background-color: unset !important;
    color: unset !important;
}

.search-results-panel .krds-pagination .page-navi.prev::before,
.search-results-panel .krds-pagination .page-navi.next::after {
    display: none !important;
}

.search-results-panel .krds-pagination .page-navi.disabled {
    color: #9ca3af !important;
    pointer-events: none;
}

.search-results-panel .krds-pagination .page-links {
    display: flex !important;
    gap: 4px;
}

.search-results-panel .krds-pagination .page-link {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    min-width: 24px;
    height: 24px;
    color: #6b7280;
    text-decoration: none;
}

.search-results-panel .krds-pagination .page-link.active {
    font-weight: 600;
}


#addressSearchPopup .krds-pagination .page-navi.prev.disabled::before {
    background-size: 1.6rem !important;
    transform: rotate(-180deg) !important;
}

#addressSearchPopup .krds-pagination .page-navi.next:not(.disabled)::after {
    transform: rotate(180deg) !important;
}

/* Two-row Pagination Layout for ICAPP.renderPagination output */
#addressSearchPopup .krds-pagination {
    display: flex;
    flex-wrap: wrap;
    /* Allow wrapping */
    justify-content: center;
    align-items: center;
    width: 100%;
    gap: 8px;
    /* Gap between rows */
}

/* Force buttons to the top row (Order 1 & 2) */
#addressSearchPopup .krds-pagination .page-navi.prev {
    order: 1;
    margin-right: 10px;
    /* Space between buttons */
}

#addressSearchPopup .krds-pagination .page-navi.next {
    order: 2;
    margin-left: 10px;
    /* Space between buttons */
}

/* Force page links to the bottom row (Order 3) */
#addressSearchPopup .krds-pagination .page-links {
    order: 3;
    width: 100%;
    /* Take full width to force new line */
    display: flex;
    justify-content: center;
    /* Center links in the second row */
    gap: 4px;
    margin-top: 4px;
}

/* Force remove padding-right from search result list as requested */
.krds-modal.integrated-search .box-area.address .list-result {
    padding-right: 0 !important;
}

/* Add padding bottom to modal content as requested */
#addressSearchPopup .modal-conts.gap12 {
    padding-bottom: var(--krds-padding-6);
}

/* Resize address search popup */
#addressSearchPopup .modal-dialog {
    width: 500px !important;
    max-width: none !important;
}

/* Gray badge styling */
.krds-modal.integrated-search .list-result .tag.gray {
    background-color: var(--krds-color-light-gray-10);
    color: var(--krds-color-light-gray-80);
}

/* Fix link-btn overflow and layout */
.item-result.object-item .link-btn {
    display: block;
    width: 100%;
    text-decoration: none;
    color: inherit;
}

.item-result.object-item .top-result {
    display: flex;
    align-items: center;
    width: 100%;
}

.item-result.object-item .box-text {
    display: flex;
    align-items: center;
    width: 100%;
    min-width: 0;
    /* Crucial for flex child truncation */
    gap: 0.4rem;
    /* Spacing between items */
}

/* Text truncation for search result titles */
.item-result.object-item .tit {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    /* Take remaining space */
    min-width: 0;
    /* Allow shrinking below content size */
}

#thumbnailContainer {
    width: 100%;
}