/* 基础层级：地图容器 */
#map {
    z-index: 100;
    height: 100vh;
    width: 100vw;
}

/* 中层：文件列表、字段筛选、图源控制等 */
#file-list,
#field-list,
#tianditu-controls,
#tile-source-controls {
    z-index: 1000;
}

#file-list {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: white;
    padding: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    max-height: 1000px;
    overflow: hidden;
}

#file-list.folded {
    padding: 0.5rem;
    width: auto;
    height: auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

#file-list.folded #file-content {
    display: none;
}

#file-list.folded h3 {
    display: block;
}

#field-list {
    display: none;
    padding-top: 1rem;
    transition: all 0.3s ease;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    padding: 0.5rem;
    margin-top: 0.5rem;
}

#field-list input[type="text"] {
    width: 150px;
    padding: 4px 8px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    font-size: 14px;
}



/* 高层：弹出框、搜索结果、分析结果 */
.custom-popup,
#search-results,
.analysis-popup {
    z-index: 2000;
}

.custom-popup {
    position: fixed;
    right: 0;
    top: 0;
    width: 30%;
    height: 100vh;
    background-color: white;
    border-left: 1px solid #e5e7eb;
    padding: 1.5rem;
    overflow-y: auto;
    box-shadow: -2px 0 4px rgba(0, 0, 0, 0.1);
}

.custom-popup.close {
    display: none;
}

.custom-popup table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    min-width: 600px;
}

.custom-popup th,
.custom-popup td {
    padding: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    white-space: normal;
    word-wrap: break-word;
    vertical-align: top;
}

.custom-popup th {
    background-color: #f3f4f6;
    font-weight: bold;
}

.leaflet-popup-close-button {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 1.5rem;
    color: #333;
    cursor: pointer;
}

#search-results {
    width: 100%;
    max-width: 800px;
    background-color: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    padding: 1rem;
    box-sizing: border-box;
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
}

#search-results table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

#search-results th,
#search-results td {
    padding: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
}

#search-results th {
    background-color: #f3f4f6;
    font-weight: bold;
}

#search-results-close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 1.5rem;
    color: #333;
    cursor: pointer;
}

#search-results ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

#search-results li {
    padding: 0.75rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#search-results li:hover {
    background-color: #f3f4f6;
}

.analysis-popup {
    position: fixed;
    right: 0;          /* 定位到右侧 */
    top: 0;
    bottom: 0;
    width: 30%;        /* 设置右侧宽度（可根据需求调整） */
    background: white; /* 背景色改为白色 */
    padding: 1.5rem;
    overflow-y: auto;  /* 允许垂直滚动 */
    border-left: 1px solid #e5e7eb; /* 添加左侧边框 */
    box-shadow: -2px 0 4px rgba(0, 0, 0, 0.1); /* 添加阴影 */
}

.analysis-popup table {
    margin: 1rem 0;
}

.analysis-popup th,
.analysis-popup td {
    border: 1px solid #e5e7eb;
    padding: 0.5rem;
    text-align: left;
}

/* 最高层：临时提示、加载中 */
#loading,
#marker-hint {
    z-index: 3000;
}

#loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(255, 255, 255, 0.9);
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: none;
}

#marker-hint {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 16px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-size: 14px;
    display: none;
}

/* 移除 !important 并优化样式优先级 */
.leaflet-div-icon {
    background: none;
    border: none;
}

.assessment-marker span.assessment-text {
    font-size: 16px;
    font-weight: bold;
    color: red;
    margin-left: 5px;
    display: inline-block;
    text-shadow: 1px 1px 2px white;
}

.assessment-marker {
    background: none;
    border: none;
}

.assessment-marker i {
    color: red;
}

.assessment-text {
    font-size: 12px; 
    margin-left: 5px;
    color: red;
    font-weight: bold;
    text-shadow: 1px 1px 2px white;
}

/* 标注控制按钮样式 */
#marker-control {
    position: fixed;
    bottom: 10px;
    left: 180px;
    background-color: white;
    padding: 0.3rem 0.3rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.3rem;
    z-index: 1001;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #ff0000;
}

#marker-control span {
    font-size: 13px;
    font-weight: bold;
    margin-left: 3px;
}

#marker-control.active {
    border-color: #3b82f6;
    background-color: #bfdbfe;
}

#marker-control:hover {
    transform: translateY(-2px);
}

/* 选择分析按钮样式 */
#select-analysis-btn {
    position: fixed;
    bottom: 11px;
    left: 265px;
    z-index: 1000;
    padding: 0.3rem 0.3rem; /* 对应 Tailwind 的 py-1.5 px-3，精确控制内边距 */
    width: auto; /* 自动适应内容（默认），如需固定宽度：width: 120px; */
    font-size: 0.8rem;
    border: none;
    border-radius: 0.3rem;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

#tianditu-controls {
    position: fixed;
    bottom: 10px;
    left: 10px;
    background-color: white;
    padding: 0.3rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

/* 切换按钮样式 */
.toggle-btn {
    cursor: pointer;
    color: #3b82f6;
    text-decoration: none;
    transition: color 0.3s ease;
    font-size: 0.8rem;
    margin-top: 1rem;
    display: block;
}



#tile-source-controls {
    position: fixed;
    bottom: 10px;
    left: 95px;
    background-color: white;
    padding: 0.3rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

/* 自定义复选框样式 */
input[type="checkbox"] {
    appearance: none;
    width: 1.25rem;
    height: 1.25rem;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.5rem;
}

input[type="checkbox"]:checked {
    background-color: #3b82f6;
    border-color: #3b82f6;
}

input[type="checkbox"]:checked::before {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: white;
    font-size: 0.875rem;
}

/* 颜色选择器样式 */
input[type="color"] {
    width: 1.5rem;
    height: 1.5rem;
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: 0.5rem;
}

/* 天地图切换按钮样式 */
#tianditu-toggle {
    cursor: pointer;
    color: #3b82f6;
    text-decoration: none;
    transition: color 0.3s ease;
    display: inline-block;
    font-size: 0.8rem;
}

#tianditu-content {
    display: none;
    padding-top: 0.5rem;
    font-size: 12px;
}

#tianditu-content h3 {
    color: #333;
    font-size: 0.8rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid #e5e7eb;
}

#layer-road, #layer-name {
    width: 16px;
    height: 16px;
    margin-right: 8px;
}

#layer-road:checked::before, #layer-name:checked::before {
    font-size: 12px;
}

/* 搜索容器样式 */
#search-container {
    position: absolute;
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    width: 100%;
    max-width: 600px;
    padding: 1rem;
    box-sizing: border-box;
    z-index: 1001;
}

/* 网站标题样式 */
#site-title {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.8), rgba(59, 130, 246, 0.8));
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
    text-align: center;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 1002;
    width: 100%;
    max-width: 430px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 搜索切换容器样式 */
#search-toggle-container {
    position: fixed;
    top: 0;
    left: calc(50% + 220px);
    padding: 0.5rem;
    z-index: 1002;
}

/* 搜索切换按钮样式 */
#search-toggle {
    cursor: pointer;
    font-size: 1rem;
    color: red;
    text-decoration: none;
    font-weight: bold;
}

/* 搜索输入框样式 */
#search-input {
    padding: 0.75rem;
    width: 100%;
    max-width: 400px;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    opacity: 0.9;
}

/* 搜索按钮样式 */
#search-button {
    width: auto;
    padding: 0.75rem 1.5rem;
    background-color: #3b82f6;
    color: white;
    font-size: 1rem;
    font-weight: bold;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    opacity: 0.9;
}

#search-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

#search-button:hover {
    background-color: #2563eb;
}

/* 新增折叠按钮样式 */
.foldable-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.foldable-btn {
    cursor: pointer;
    font-size: 0.8rem;
    margin-top: -0.5rem;
    padding: 0.5rem;
    color: #64748b;
    transition: transform 0.3s ease;
    display: flex;
    align-items: center;
}

#file-list.folded .foldable-btn {
    display: flex;
    align-items: center;
}

#file-list table {
    width: 100%;
    border-collapse: collapse;
}

#file-list th,
#file-list td {
    padding: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
}

#file-list th {
    background-color: #f3f4f6;
    font-weight: bold;
}

#tile-source-toggle {
    cursor: pointer;
    color: #3b82f6;
    text-decoration: none;
    transition: color 0.3s ease;
    display: inline-block;
    font-size: 0.8rem;
}

#tile-source-toggle img {
    display: inline-block;
    vertical-align: middle;
    margin-right: 8px; /* 添加图标和文本之间的间距 */
    max-width: 100%; /* 让图片可以自适应容器大小 */
    height: auto; /* 保持图片的宽高比 */
}


#tile-source-content {
    display: none;
    padding-top: 0.5rem;
}

#tile-source-content label.text-gray-700 {
    font-size: 12px;
    margin-left: 8px;
}

.overlapping-feature {
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.overlapping-feature:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.filter-controls {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.select-operator {
    min-width: 100px;
    padding: 4px;
    margin-right: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.filter-input {
    flex-grow: 1;
    padding: 4px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

#field-list {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 8px;
}

#field-list::-webkit-scrollbar {
    width: 6px;
}

#field-list::-webkit-scrollbar-thumb {
    background-color: #c1c1c1;
    border-radius: 3px;
}

.sticky-table {
    overflow-x: auto;
    width: 100%;
}

.sticky {
    position: sticky;
    z-index: 10;
}

.sticky.left-0 {
    left: 0;
    background-color: #f3f4f6;
    z-index: 20;
}

.sticky.top-0 {
    top: 0;
}

.highlighted {
    fill: #000000;
    stroke: #ff4d4f;
    stroke-width: 18px;
    opacity: 1;
}    

#land-assessment-btn {
    position: fixed;
    bottom: 10px;
    left: 350px;
    background-color: white;
    padding: 0.3rem 0.3rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.3rem;
    z-index: 1001;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #3b82f6;
}

#land-assessment-btn span {
    font-size: 13px;
    font-weight: bold;
    margin-left: 3px;
}

#land-assessment-btn:hover {
    transform: translateY(-2px);
}
#land-assessment-popup {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 39%;
    background: white;
    padding: 1.5rem;
    overflow-y: auto;
    border-left: 1px solid #e5e7eb;
    box-shadow: -2px 0 4px rgba(0, 0, 0, 0.1);
}

#land-assessment-popup table {
    margin: 1rem 0;
}

#land-assessment-popup th,
#land-assessment-popup td {
    border: 1px solid #e5e7eb;
    padding: 0.5rem;
    text-align: left;
}

/* 针对小屏幕设备（如手机）的样式调整 */
@media (max-width: 768px) {
    #search-container {
        /* 调整搜索容器的布局方向为垂直 */
        flex-direction: column; 
        /* 使内容居中显示 */
        align-items: center; 
        /* 增加上下间距 */
        padding: 1rem 0; 
    }

    #search-input {
        /* 输入框宽度占满容器 */
        width: 90%; 
        /* 增加底部间距 */
        margin-bottom: 1rem; 
    }

    #search-button {
        /* 按钮宽度占满容器 */
        width: 90%; 
    }
}

