* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    height: 100vh;
    display: flex;
}

#sidebar {
    width: 280px;
    background: #2c3e50;
    color: #ecf0f1;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0,0,0,0.3);
}

.sidebar-header {
    padding: 15px;
    background: #1a252f;
    border-bottom: 1px solid #34495e;
}

.sidebar-header h3 {
    font-size: 16px;
    font-weight: 500;
}

.search-box {
    padding: 10px;
    background: #1a252f;
    border-bottom: 1px solid #34495e;
}

.search-mode-toggle {
    display: flex;
    gap: 0;
    margin-bottom: 8px;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #4a6278;
}

.search-mode-btn {
    flex: 1;
    padding: 5px 0;
    border: none;
    background: #2c3e50;
    color: #95a5a6;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.search-mode-btn.active {
    background: #3498db;
    color: #fff;
}

.search-mode-btn:hover:not(.active) {
    background: #34495e;
}

.search-input-wrap {
    display: flex;
    gap: 4px;
}

.search-input-wrap input {
    flex: 1;
    padding: 7px 10px;
    border: 1px solid #4a6278;
    border-radius: 4px;
    background: #2c3e50;
    color: #ecf0f1;
    font-size: 13px;
    outline: none;
}

.search-input-wrap input:focus {
    border-color: #3498db;
}

.search-input-wrap input::placeholder {
    color: #7f8c8d;
}

.search-btn {
    padding: 7px 10px;
    border: 1px solid #4a6278;
    border-radius: 4px;
    background: #3498db;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.search-btn:hover {
    background: #2980b9;
}

.search-results {
    max-height: 250px;
    overflow-y: auto;
    margin-top: 6px;
    display: none;
}

.search-results.has-items {
    display: block;
}

.search-result-item {
    padding: 8px 10px;
    background: #2c3e50;
    border-radius: 4px;
    margin-bottom: 4px;
    cursor: pointer;
    transition: background 0.2s;
    border-left: 3px solid #3498db;
}

.search-result-item:hover {
    background: #4a6278;
}

.search-result-item .result-name {
    font-size: 13px;
    color: #ecf0f1;
    font-weight: 500;
}

.search-result-item .result-sub {
    font-size: 11px;
    color: #95a5a6;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-result-item.layer-match {
    border-left-color: #e67e22;
}

.search-hint {
    padding: 8px;
    text-align: center;
    color: #95a5a6;
    font-size: 12px;
}

.locate-btn {
    background: rgba(255,255,255,0.9);
    border: 2px solid rgba(0,0,0,0.2);
    border-radius: 4px;
    width: 34px;
    height: 34px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: background 0.2s;
}

.locate-btn:hover {
    background: #fff;
}

.locate-btn.locating {
    background: #f0f0f0;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.leaflet-control-locate {
    box-shadow: 0 1px 5px rgba(0,0,0,0.3);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.layer-section {
    margin-bottom: 15px;
    background: #34495e;
    border-radius: 6px;
    padding: 12px;
}

.layer-section h4 {
    font-size: 13px;
    margin-bottom: 10px;
    color: #3498db;
    border-bottom: 1px solid #4a6278;
    padding-bottom: 6px;
}

.layer-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.layer-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: #2c3e50;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}

.layer-item:hover {
    background: #4a6278;
}

.layer-item input[type="radio"],
.layer-item input[type="checkbox"] {
    accent-color: #3498db;
}

.import-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.btn {
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
    flex: 1;
    min-width: 70px;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-danger {
    background: #e74c3c;
    color: white;
    font-size: 11px;
    padding: 4px 8px;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-warn {
    background: #f39c12;
    color: white;
    font-size: 11px;
    padding: 4px 8px;
}

.btn-warn:hover {
    background: #d68910;
}

#map {
    flex: 1;
    height: 100vh;
}

#coordinates {
    position: absolute;
    bottom: 30px;
    left: 290px;
    background: rgba(44, 62, 80, 0.9);
    color: #ecf0f1;
    padding: 8px 15px;
    border-radius: 4px;
    font-size: 12px;
    z-index: 1000;
    display: flex;
    gap: 20px;
}

.empty-hint {
    color: #95a5a6;
    font-size: 12px;
    text-align: center;
    padding: 10px;
}

.layer-item-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
}

.layer-item-name {
    font-size: 12px;
    word-break: break-all;
}

.measure-result {
    background: #2c3e50;
    padding: 8px 10px;
    border-radius: 4px;
    margin-bottom: 6px;
    font-size: 12px;
}

.measure-result .label {
    color: #3498db;
    font-weight: bold;
}

.measure-result .value {
    color: #ecf0f1;
    margin-top: 4px;
}

.leaflet-draw-tooltip {
    background: rgba(44, 62, 80, 0.9);
    color: #ecf0f1;
    border: none;
    border-radius: 4px;
    padding: 5px 10px;
    font-size: 12px;
}

.leaflet-draw-tooltip:before {
    border-right-color: rgba(44, 62, 80, 0.9);
}

.layer-color-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.leaflet-popup-content {
    margin: 8px 12px;
    max-height: 300px;
    overflow-y: auto;
}

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

.popup-title {
    font-size: 14px;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 2px solid #3498db;
}

.popup-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.popup-table td {
    padding: 4px 8px;
    border: 1px solid #ddd;
    vertical-align: top;
}

.popup-table tr:nth-child(even) {
    background: #f8f9fa;
}

.popup-table tr:hover {
    background: #e8f4fd;
}

.popup-key {
    font-weight: bold;
    color: #2c3e50;
    white-space: nowrap;
    width: 35%;
}

.popup-val {
    color: #555;
    word-break: break-all;
}

.leaflet-tooltip.sector-label {
    background: rgba(44, 62, 80, 0.85);
    border: none;
    border-radius: 3px;
    color: #fff;
    font-size: 11px;
    padding: 2px 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    white-space: nowrap;
}

.leaflet-tooltip.sector-label::before {
    border-top-color: rgba(44, 62, 80, 0.85);
}

.sector-text-marker {
    background: none;
    border: none;
    font-size: 11px;
    font-weight: 500;
    color: #2c3e50;
    text-shadow: 1px 1px 0 #fff, -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 0 1px 0 #fff, 0 -1px 0 #fff, 1px 0 0 #fff, -1px 0 0 #fff;
    white-space: nowrap;
    pointer-events: none;
}

#loadingOverlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 10000;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.loading-spinner {
    width: 40px; height: 40px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: #3498db;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    color: #fff;
    font-size: 14px;
}

.context-menu {
    display: none;
    position: fixed;
    z-index: 10001;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    min-width: 220px;
    overflow: hidden;
    font-size: 13px;
}

.context-menu.show {
    display: block;
}

.context-title {
    padding: 8px 14px;
    background: #2c3e50;
    color: #ecf0f1;
    font-weight: 500;
    font-size: 12px;
}

.context-coord {
    padding: 10px 14px;
    font-family: monospace;
    font-size: 12px;
    color: #2c3e50;
    border-bottom: 1px solid #eee;
    line-height: 1.6;
    word-break: break-all;
}

.context-actions {
    display: flex;
    flex-direction: column;
}

.context-actions button {
    padding: 8px 14px;
    border: none;
    background: #fff;
    text-align: left;
    cursor: pointer;
    font-size: 13px;
    color: #2c3e50;
    transition: background 0.15s;
}

.context-actions button:hover {
    background: #e8f4fd;
}
