:root {
    --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    --transition: all 0.3s ease;
    --border-radius: 4px;
    --primary: #3b82f6;
    /* 밝은 파란색 */
    --primary-dark: #2563eb;
    --secondary: #64748b;
    /* 슬레이트 그레이 */
    --success: #10b981;
    /* 그린 */
    --danger: #ef4444;
    /* 레드 */
    --warning: #f59e0b;
    /* 앰버 */
    --info: #3b82f6;
    /* 블루 */
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--light-bg);
    color: #334155;
}

/* 모달 개선 */
.modal-content {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.modal-header {
    padding: 1.25rem 1.5rem;
    background-color: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.modal-body {
    padding: 1.5rem;
}

/* 버튼 스타일 */
.btn {
    border-radius: var(--border-radius);
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: var(--transition);
}

.btn-custom-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}

.btn-custom-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.25);
}

.btn-outline-custom {
    border-color: var(--secondary);
    color: var(--secondary);
}

.btn-outline-custom:hover {
    background-color: #f1f5f9;
    color: #334155;
}

/* 입력 필드 */
.form-control,
.form-select {
    border-radius: var(--border-radius);
    padding: 0.6rem 1rem;
    border-color: #e2e8f0;
    min-height: 48px;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

textarea.form-control {
    min-height: 120px;
}

/* 사이드바 개선 */
.sidebar {
    background-color: white;
    border-radius: 0;
    box-shadow: var(--box-shadow);
    /* transition: var(--transition); */
    display: flex;
    flex-direction: column;
    top: 120px;
    height: calc(100vh - 120px);

    position: fixed;
    left: 0;
    bottom: 0;
    width: 350px;
    padding: 1rem;
    background: white;
    z-index: 10;
    overflow-y: auto;
}


.sidebar-header {
    padding: 1.0rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    background-color: white;
    z-index: 20;
}

/* .side-panels {
    padding: 0.1rem;
} */

.side-panels button {
    margin-bottom: 0.15rem;
}

/* 레이아웃 스타일 */
.content-wrapper {
    margin-left: 350px;
    width: 100%;
    /* width: calc(100% - 350px); */
    /* height: calc(100% - 70px); */
    position: relative;
}


/* 반응형 디자인 */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 100%;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .content-wrapper {
        margin-left: 0;
        width: 100%;
    }

    .toggle-sidebar {
        display: block;
    }
}

/* 지도 컨테이너 */
#map {
    /* border-radius: var(--border-radius); */
    /* box-shadow: var(--box-shadow); */
    overflow: hidden;
    /* top: 10px; */
    /* bottom: 0; */
    height: calc(100vh - 122px);
    z-index: 1;
    /* position: absolute; */
    /* top: 0; */
    /* width: calc(100vw - 350px); */
    /* width: 100%; */
    /* height: 100vh; */
    /* left: 350px; */
}

#geocode-summary {
    text-align: right;
}

#geocode-speed {
    opacity: 0.01;
    ;
}

/* 카드와 리스트 */
.list-group-item {
    border-color: #e2e8f0;
    padding: 0.75rem 1rem;
    transition: background-color 0.15s ease;
}

.list-group-item:hover {
    background-color: #f8fafc;
}

.publicdata-item {
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: var(--border-radius);
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.publicdata-item.visualized {
    background-color: aliceblue;
    color: black;
    font-weight: 600;
    border-color: var(--primary);
}

/* 뱃지 */
.badge {
    font-weight: 500;
    border-radius: 20px;
    padding: 0.35em 0.75em;
}

/* 다운로드 옵션 */
.download-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.download-file-button {
    flex: 1 0 auto;
    min-width: 120px;
    transition: var(--transition);
    position: relative;
    margin: 5px;
}

.download-file-button:hover {
    transform: translateY(-1px);
}

/* 애니메이션 효과 */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 토글 사이드바 버튼 개선 */
.toggle-sidebar {
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    box-shadow: var(--box-shadow);
    /* position: fixed; */
    z-index: 90;
    left: 1rem;
    top: 6.0rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: var(--transition);
}


.toggle-sidebar:hover {
    background-color: var(--primary);
    color: white;
}

.toggle-sidebar-highlight {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: var(--box-shadow);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 5px rgba(59, 130, 246, 0.3);
    }

    100% {
        transform: scale(1);
        box-shadow: var(--box-shadow);
    }
}

/* 결과 목록 영역 */
.geocode-list {
    /* border-top: 1px solid rgba(0, 0, 0, 0.05);
    flex-grow: 1;
    overflow-y: auto;
    height: calc(100vh - 400px); */
}

.summary-container {
    background-color: var(--light-bg);
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    position: sticky;
    /* position: absolute; */
    bottom: 60px;
    /* bottom: 70px; */
    left: 0;
    right: 0;
}

/* 기타 UI 요소 */
.dropdown-menu {
    border-radius: var(--border-radius);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
    padding: 0.5rem;
    /* transition: var(--transition); */
}

.dropdown-item {
    border-radius: var(--border-radius);
    padding: 0.5rem 1rem;
}

.alert {
    border-radius: var(--border-radius);
    border: none;
}

.alert-info {
    background-color: rgba(59, 130, 246, 0.1);
    color: #1e40af;
}

.alert-success {
    background-color: rgba(34, 197, 94, 0.1);
    color: #166534;
}

#loading-spinner {
    /* display: none; */
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    width: 3rem;
    height: 3rem;
}

#upload-spinner{
    display: none;
    position: fixed;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
}

.table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

.table th {
    font-weight: 600;
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 2px solid #e2e8f0;
}

.table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.table tbody tr:hover {
    background-color: #f8fafc;
}

/* 제어 패널 스타일 */
.control-panel {
    background: white;
    border-radius: 8px;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    padding: 1rem;
    /* margin-bottom: 0rem; */
    margin: 0.5rem;
}

.leaflet-container {
    font: 0.8rem "Segoe UI", Arial, Helvetica, sans-serif;
    z-index: 1;
}

@media (max-width: 768px) {
    .modal-button {
        margin-left: 3rem !important;
        margin-right: 3rem !important;
    }
}

.modal-content {
    position: absolute;
}

.modal-header {
    cursor: move;
    /* 'grabbing' 대신 'move'를 사용하여 드래그 가능함을 표시 */
    position: relative;
    z-index: 10;
    /* 헤더가 항상 위에 오도록 z-index 설정 */
    padding: 1rem 1rem;
    /* 패딩 조정으로 더 넓은 드래그 영역 확보 */
}

.modal-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: transparent;
    z-index: -1;
}

/* 모달 애니메이션 개선 */
.modal.fade .modal-dialog {
    transition: transform 0.15s ease-out;
}

.modal.show .modal-dialog {
    transform: none !important;
    /* 내장된 transform 제거 */
}


/* 활성화된 네비게이션 항목 스타일 */
.navbar .nav-link.active {
    position: relative;
    font-weight: 600;
    color: var(--primary, #3b82f6) !important;
}

/* 밑줄 효과 */
.navbar .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0.5rem;
    right: 0.5rem;
    height: 3px;
    background-color: var(--primary, #3b82f6);
    border-radius: 2px;
}


.geocode-popup {
    max-width: 300px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.popup-header {
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 0.5rem;
    margin-bottom: 0.75rem;
}

.popup-title {
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: #495057;
}

.popup-coords {
    font-size: 0.8rem;
    color: #6c757d;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.popup-body {
    max-height: 300px;
    overflow-y: auto;
}

@media (max-width: 768px) {
    .popup-body {
        max-height: 500px;
    }
}

.popup-section {
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px dashed #e9ecef;
}

.popup-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.section-title {
    margin: 0 0 0.5rem 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.section-content {
    font-size: 0.9rem;
}

.info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.25rem;
    padding: 0.25rem 0;
    border-bottom: 1px dotted #f0f0f0;
}

.info-row:last-child {
    margin-bottom: 0;
    border-bottom: none;
}

.info-label {
    color: #6c757d;
    flex: 0 0 40%;
    font-weight: 500;
}

.info-value {
    color: #212529;
    flex: 0 0 60%;
    /* text-align: right; */
    word-break: break-word;
}

.popup-footer {
    margin-top: 0.75rem;
    text-align: center;
}

.copy-btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

/* Leaflet 팝업 컨테이너 스타일 오버라이드 */
.leaflet-popup-content {
    margin: 10px 14px;
    min-width: 250px;
}

.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.15);
}

.hd-history-link {
    color: #0d6efd;
    text-decoration: none;
    cursor: pointer;
}

.hd-history-link:hover {
    text-decoration: underline;
    color: #0a58ca;
}

.hd-history-container {
    margin-top: 0.5rem;
    /* margin-left: 1rem;
    padding: 0.5rem;
    border-left: 2px solid #e9ecef; */
    font-size: 0.8rem;
}

.hd-history-loading {
    display: flex;
    align-items: center;
    font-size: 0.75rem;
    color: #6c757d;
}

.section-subtitle {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.table-sm td,
.table-sm th {
    padding: 0.25rem 0.2rem;
    font-size: 0.75rem;
}

/* 선택된 항목 스타일 */
.selected-item {
    background-color: #e7f2ff;
    border-left: 4px solid #0d6efd;
    font-weight: 500;
    color: #0d6efd;
    padding-left: 8px;
    transition: all 0.2s ease;
}

/* 마우스 오버 효과 */
#selectable li:hover {
    background-color: #f8f9fa;
    cursor: pointer;
}

/* 기본 리스트 아이템 스타일 */
#selectable li {
    /* border-left: 4px solid transparent;
    padding: 8px 12px; */
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.2s ease;
}

/* #selectable li:last-child {
    border-bottom: none;
} */

.notes {
    font-size: small;
    color: #666;
}

#resultTable thead th {
    min-width: 50px;
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#resultTable td {
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.region-label {
    color: black;
    font-weight: bold;
    text-align: center;
    text-shadow: -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff;
}

.navbar-brand-img {
    height: 32px;
    width: auto;
    max-width: 120px;
    object-fit: contain;
}

#navbar-brand-logo {
    height: 32px;
    width: auto;
    max-width: 120px;
    object-fit: contain;
}

.column-type {
    display: inline-block;
    width: 70px;
    text-align: center;
    border: 1px solid #e2e8f0;
    border-radius: var(--border-radius);
    background-color: #f8fafc;
}

.column-type-int {
    color: #0d6efd;
}

.column-type-float {
    color: #198754;
}

.column-type-string {
    color: #ff9800;
}

.column-type-boolean {
    color: #dc3545;
}

.column-type-object {
    color: #6f42c1;
}

.sidebar .dropdown-menu {
    width: 100%;
}
.sidebar ul {
    font-size: smaller;
}

.sidebar .dropdown-item {
    width: 100%;
    /* border-radius: var(--border-radius); */
    padding: 0.3rem 0.5rem;
}

.color-ramp-item {
    display: inline-block;
    width: 100%;
    height: 14px;
    margin-right: 5px;
    /* border-radius: 50%; */
    vertical-align: middle;
}

.theme-item {
    font-size: 0.75rem;
}

.toolbar-right select {
    min-width: 100px;
    min-height: 40px;
    max-height: 40px;
    overflow-y: auto;
}


/* Tabulator 스타일 커스터마이징 */
.tabulator {
    font-size: 0.875rem;
}

.tabulator .tabulator-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.tabulator .tabulator-header .tabulator-col {
    background-color: #f8f9fa;
    border-right: 1px solid #dee2e6;
}
.tabulator .tabulator-row {
    border-bottom: 1px solid #dee2e6;
}
.tabulator .tabulator-row:hover {
    background-color: #f8f9fa;
}

.tabulator-row .highlighted-row {
    background-color: #ffc107 !important;
}

.tabulator-row.tabulator-selected {
    background-color: #b3cbfa !important;
}

.tabulator .tabulator-cell {
    border-right: 1px solid #dee2e6;
    padding: 1px 4px;
}

.tabulator .tabulator-footer {
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

/* 테이블 헤더 숨김 */
/* #resultList > .tabulator-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    display: none;
} */




#resultList {
    border: none;
}

#resultList .tabulator {
    border: none !important;
}

#resultList .tabulator-cell {
    border-right: 0px solid #dee2e6;
}

.tabulator-row .tabulator-cell {
  padding-top: 8px;
  padding-bottom: 8px;
}

#resultList .tabulator-row {
    /* border: 1px solid #dee2e6; */
    /* margin: 0.4rem; */
    /* margin-right: 1rem; */
    /* padding-right: 1rem; */
    font-size: 0.9rem;
    border-radius: 7px;
}

#resultList .tabulator-row-even {
    background-color:transparent;
}

#resultList .tabulator-row-odd {
    background-color:transparent;
}


#resultList .tabulator-tableholder {
    overflow-x: hidden !important;
}

#resultList .badge {
    padding: 0.55em 0.75em;
}

.bg-representative {
    --bs-bg-opacity: 1;
    background-color: orchid !important;
}

.address-cell {
    white-space: normal !important;
    word-break: auto-phrase !important;
    /* overflow-wrap: break-word; */
    /* padding-right: 40px; */
    width: calc(100% - 50px) !important;
}

#colorRampDropdown {
    height: 2rem;
}

.legend-item {
    font-size: 0.75rem;
    white-space: nowrap;
    height: 20px;
    display: flow-root;
    margin-bottom: 5px
    /* align-items: left; */
}

.legend-color {
    display: inline-block;
    width: 40px;
    height: 20px;
    margin-right: 5px;
    /* border-radius: 3px; */
}

.legend-text {
    /* max-width: 100px; */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}