/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    height: 100vh;
    overflow: hidden;
}

/* 工具栏样式 */
#toolbar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    position: relative;
}

.toolbar {
    position: fixed;
    top: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.95);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.tool-group {
    display: flex;
    gap: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.tool-btn {
    padding: 4px 8px;
    border: none;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 11px;
    white-space: nowrap;
    min-width: 50px;
}

.tool-btn:hover {
    background: #e9ecef;
}

.tool-btn.active {
    background: #007bff;
    color: white;
}

/* 弹窗中的图钉样式控件 */
.pin-style-controls {
    display: flex;
    gap: 15px;
    margin-top: 8px;
}

.pin-style-controls .control-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pin-style-controls label {
    font-size: 11px;
    color: #333;
    margin: 0;
}

/* 弹窗中的样式选择器特殊样式 */
.pin-style-controls .styled-select {
    border: 1px solid #ccc;
    background: white;
    color: #333;
    padding: 4px 8px;
}

.pin-style-controls .styled-select:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
    outline: none;
}

.pin-style-controls .styled-select option {
    background: white;
    color: #333;
}

.filter-group {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 5px 10px;
    background: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.filter-group label {
    font-size: 12px;
    color: #666;
    margin: 0;
}

.filter-group select {
    padding: 4px 8px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 12px;
    min-width: 120px;
}

.layer-group {
    position: relative;
    display: inline-block;
}

.layer-btn {
    padding: 8px 16px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 6px;
    background: rgba(255,255,255,0.1);
    color: white;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.layer-btn:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.5);
    transform: translateY(-1px);
}

.layer-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1001;
    min-width: 150px;
    margin-top: 2px;
}

.layer-dropdown.show {
    display: block;
}

.layer-option {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    font-size: 14px;
    color: #333;
    transition: background-color 0.2s;
}

.layer-option:last-child {
    border-bottom: none;
}

.layer-option:hover {
    background: #f8f9fa;
}

.layer-option.active {
    background: #007bff;
    color: white;
}

/* 工具栏区域样式 */
.toolbar-section {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.toolbar-section:last-child {
    border-bottom: none;
}

/* 标题区域 */
.title-section {
    justify-content: center;
    border-bottom: 2px solid rgba(255,255,255,0.2);
    padding: 12px 0;
}

.title-section h1 {
    font-size: 1.3em;
    font-weight: bold;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* 区域标签 */
.section-label {
    font-weight: 600;
    font-size: 12px;
    color: rgba(255,255,255,0.9);
    min-width: 45px;
    text-align: right;
}

/* 控件容器 */
.filter-controls,
.style-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.control-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

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

/* 标签和输入框样式 */
.control-item label {
    font-weight: 500;
    font-size: 11px;
    color: #333;
    white-space: nowrap;
}

/* 年份区间样式 */
.year-range .year-inputs {
    display: flex;
    align-items: center;
    gap: 6px;
}

.year-input {
    flex: 1;
    min-width: 70px;
}

.year-separator {
    color: #666;
    font-weight: 500;
    font-size: 12px;
}

.styled-input,
.styled-select {
    padding: 4px 8px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    background: rgba(255,255,255,0.1);
    color: white;
    font-size: 11px;
    min-width: 100px;
    transition: all 0.2s ease;
}

/* 下拉菜单选项样式 */
.styled-select option {
    background: #2c3e50;
    color: white;
    padding: 8px;
}

.styled-select option:hover {
    background: #34495e;
}

.styled-select option:checked {
    background: #3498db;
    color: white;
}

.styled-input:focus,
.styled-select:focus {
    outline: none;
    border-color: rgba(255,255,255,0.6);
    background: rgba(255,255,255,0.15);
    box-shadow: 0 0 0 2px rgba(255,255,255,0.1);
}

.styled-input::placeholder {
    color: rgba(255,255,255,0.5);
}

/* 按钮样式 */
.action-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.action-btn.primary {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    box-shadow: 0 2px 4px rgba(0,123,255,0.3);
}

.action-btn.primary:hover {
    background: linear-gradient(135deg, #0056b3, #004085);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,123,255,0.4);
}

.action-btn.secondary {
    background: rgba(255,255,255,0.1);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
}

.action-btn.secondary:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.5);
    transform: translateY(-1px);
}

/* 工具按钮样式 */
.tool-btn {
    padding: 8px 16px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 6px;
    background: rgba(255,255,255,0.1);
    color: white;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tool-btn:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.5);
    transform: translateY(-1px);
}

.tool-btn.active {
    background: linear-gradient(135deg, #28a745, #1e7e34);
    border-color: #28a745;
    box-shadow: 0 2px 4px rgba(40,167,69,0.3);
}

/* 工具组样式 */
.tool-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 地图样式 */
#map {
    height: calc(100vh - 70px);
    width: 100%;
}

/* 图钉工具模式下的地图光标 */
#map.pin-mode {
    cursor: crosshair !important;
}

#map.select-mode {
    cursor: default;
}

/* 弹窗样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 30px;
    border: none;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover,
.close:focus {
    color: #667eea;
}

.modal h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.5em;
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid #e1e1e1;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 25px;
}

.form-buttons button {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.form-buttons button[type="submit"],
#editBtn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.form-buttons button[type="submit"]:hover,
#editBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.form-buttons button[type="button"],
#deleteBtn,
#closeDetailBtn {
    background: #f8f9fa;
    color: #6c757d;
    border: 1px solid #dee2e6;
}

.form-buttons button[type="button"]:hover,
#closeDetailBtn:hover {
    background: #e9ecef;
}

#deleteBtn {
    background: #dc3545;
    color: white;
    border: 1px solid #dc3545;
}

#deleteBtn:hover {
    background: #c82333;
    transform: translateY(-2px);
}

/* 详情内容样式 */
#detailContent {
    margin: 20px 0;
}

#detailContent h3 {
    color: #667eea;
    margin-bottom: 10px;
}

#detailContent p {
    margin-bottom: 10px;
    line-height: 1.6;
}

#detailContent .detail-item {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 10px;
}

#detailContent .detail-label {
    font-weight: bold;
    color: #555;
    display: inline-block;
    min-width: 80px;
}

/* 多选标签样式 */
.tag-selector {
    border: 2px solid #e1e1e1;
    border-radius: 8px;
    padding: 15px;
    background: #f8f9fa;
}

.available-tags {
    margin-bottom: 15px;
}

.available-tags::before {
    content: "可选标签:";
    display: block;
    font-weight: 500;
    color: #555;
    margin-bottom: 8px;
    font-size: 14px;
}

.tag-item {
    display: inline-block;
    padding: 6px 12px;
    margin: 3px;
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
    user-select: none;
}

.tag-item:hover {
    border-color: #667eea;
    background: #f0f4ff;
    transform: translateY(-1px);
}

.tag-item.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

.selected-tags {
    border-top: 1px solid #dee2e6;
    padding-top: 15px;
    min-height: 50px;
}

.selected-tags-label {
    font-weight: 500;
    color: #555;
    margin-bottom: 8px;
    font-size: 14px;
}

.selected-tags-list {
    min-height: 30px;
}

.selected-tag {
    display: inline-block;
    padding: 6px 12px;
    margin: 3px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
    user-select: none;
    position: relative;
}

.selected-tag:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    transform: translateY(-1px);
}

.selected-tag::after {
    content: "×";
    margin-left: 6px;
    font-weight: bold;
    opacity: 0.8;
}

.selected-tag:hover::after {
    opacity: 1;
}

/* 自定义图钉样式 */
.custom-pin {
    transition: all 0.3s ease;
}

.custom-pin:hover {
    transform: scale(1.1);
}

/* 圆形图钉 */
.pin-circle {
    width: 20px;
    height: 20px;
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 3px 10px rgba(0,0,0,0.3);
}

/* 方形图钉 */
.pin-square {
    width: 20px;
    height: 20px;
    border: 3px solid white;
    border-radius: 3px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.3);
}

/* 三角形图钉 */
.pin-triangle {
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-bottom: 20px solid;
    border-top: none;
    box-shadow: 0 3px 10px rgba(0,0,0,0.3);
    position: relative;
}

.pin-triangle::after {
    content: '';
    position: absolute;
    top: 3px;
    left: -9px;
    width: 0;
    height: 0;
    border-left: 9px solid transparent;
    border-right: 9px solid transparent;
    border-bottom: 15px solid white;
}

/* 菱形图钉 */
.pin-diamond {
    width: 16px;
    height: 16px;
    border: 3px solid white;
    transform: rotate(45deg);
    box-shadow: 0 3px 10px rgba(0,0,0,0.3);
}

.custom-pin:hover .pin-circle,
.custom-pin:hover .pin-square,
.custom-pin:hover .pin-triangle,
.custom-pin:hover .pin-diamond {
    box-shadow: 0 5px 20px rgba(0,0,0,0.5);
}

/* 响应式设计 */
@media (max-width: 768px) {
    #toolbar {
        flex-direction: column;
        gap: 10px;
        padding: 15px;
    }
    
    .toolbar-section {
        width: 100%;
        justify-content: center;
    }
    
    .modal-content {
        margin: 10% auto;
        padding: 20px;
        width: 95%;
    }
    
    #map {
        height: calc(100vh - 120px);
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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