* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background-color: #f5f5f5;
}

/* 消息提醒容器样式 */
.message-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
}

.message {
    background: #1a6be0;
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    margin: 10px 0;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-100px);
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 80%;
    text-align: center;
}

.message.show {
    transform: translateY(0);
    opacity: 1;
}

.message.hide {
    transform: translateY(-100px);
    opacity: 0;
}

/* 不同类型的消息样式 */
.message.success {
    background: #52c41a;
}

.message.error {
    background: #f5222d;
}

.message.warning {
    background: #faad14;
}

.message.info {
    background: #1a6be0;
}

.container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* 左侧列表样式 - 企业微信风格 */
.sidebar {
    width: 380px; /* 固定宽度400px */
    background: white;
    border-right: 1px solid #e1e8ed;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0; /* 防止侧边栏被压缩 */
}

.sidebar-header {
    position: relative;
    padding: 20px;
    background: #1a6be0;
    color: white;
    border-bottom: 1px solid #1a6be0;
}

.sidebar-header h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

/* 指挥室出品文字样式 */
.producer-text {
    position: absolute;
    bottom: 8px;
    right: 16px;
    font-size: 12px;
    color: #FFFFFF;
    font-weight: 400;
}

/* 搜索框样式 */
.search-container {
    padding: 16px 16px 8px 16px;
    background: white;
    border-bottom: 1px solid #e1e8ed;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    color: #8c8c8c;
    z-index: 1;
}

.search-input {
    width: 100%;
    padding: 10px 36px 10px 38px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    font-size: 14px;
    background: #fafafa;
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: #1a6be0;
    background: white;
    box-shadow: 0 0 0 2px rgba(26, 107, 224, 0.2);
}

.search-input::placeholder {
    color: #8c8c8c;
}

.clear-search-btn {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: #8c8c8c;
    cursor: pointer;
    padding: 4px;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.clear-search-btn:hover {
    color: #1a6be0;
    background: #f0f7ff;
}

.tree-view {
    flex: 1;
    overflow-y: auto;
    padding: 8px 16px 16px 16px;
    background: white;
}

.tree-item {
    margin: 8px 0;
}

/* 村社样式 - 企业微信蓝色 */
.village-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: #f0f7ff;
    border: 1px solid #d9ecff;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 8px;
}

.village-header:hover {
    background: #e6f3ff;
    border-color: #c0e0ff;
}

.village-header h3 {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    color: #1a6be0;
}

.village-header h3 .stats {
    color: #86909c; /* 企业微信灰色 */
    font-weight: 400;
    font-size: 13px;
    margin-left: 4px;
}

/* 统计数据徽章样式 */
.stats-badge {
    background: #f0f7ff;
    color: #1a6be0;
    border: 1px solid #d9ecff;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin-left: 8px;
    white-space: nowrap;
}

.grid-header .stats-badge {
    background: #e8f2ff;
    color: #2d8cf0;
    border-color: #c0e0ff;
    font-size: 11px;
    padding: 3px 6px;
}

.grid-header {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    background: #f7fbff;
    border: 1px solid #e8f2ff;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 6px 0;
    gap: 8px;
}

.grid-header:hover {
    background: #edf6ff;
    border-color: #d4e9ff;
}

.grid-header h3 {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    margin: 0;
    color: #2d8cf0;
}

.grid-header h3 .stats {
    color: #86909c; /* 企业微信灰色 */
    font-weight: 400;
    font-size: 13px;
    margin-left: 4px;
}

.grid-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.tree-content {
    margin-left: 20px;
    padding-left: 12px;
}

/* 网格操作按钮样式 - 统一设计 */
.show-all-btn, .add-house-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: #2d8cf0;
    background: #f0f7ff;
    border: 1px solid #d9ecff;
    font-size: 14px;
}

.show-all-btn:hover, .add-house-btn:hover {
    background-color: #2d8cf0;
    color: white;
    border-color: #2d8cf0;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(45, 140, 240, 0.2);
}

.show-all-btn:hover::before,
.add-house-btn:hover::before {
    color: white;
}

/* 图标按钮样式 */
.show-all-btn::before {
    content: "📍";
}

.add-house-btn::before {
    content: "➕";
}

.house-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    margin: 6px 0;
    background: white;
    border: 1px solid #e8f2ff;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.house-item:hover {
    background: #f7fbff;
    border-color: #d4e9ff;
    box-shadow: 0 2px 8px rgba(26, 107, 224, 0.1);
}

.house-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #2d8cf0; /* 企业微信蓝色 */
}

/* 不同人口数量的房屋颜色标识 - 企业微信蓝色系 */
.house-item[data-people="low"]::before { background: #52c41a; } /* 10人以下 - 绿色 */
.house-item[data-people="medium"]::before { background: #faad14; } /* 10-50人 - 黄色 */
.house-item[data-people="high"]::before { background: #ff7a45; } /* 50-100人 - 橙色 */
.house-item[data-people="very-high"]::before { background: #f5222d; } /* 100人以上 - 红色 */



.house-info {
    flex: 1;
    margin-left: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.house-name {
    font-weight: 500;
    color: #1d2129;
    font-size: 14px;
    flex-shrink: 0;
}

.house-stats {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #86909c;
    flex-shrink: 0;
    margin-right: 5px;
}

/* 房间数和人数标签样式 */
.room-count, .people-count {
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    background: #f7f8fa;
    color: #4e5969;
    border: 1px solid #e5e6eb;
    min-width: 40px;
    text-align: center;
    white-space: nowrap;
}

/* 人口数量标签 - 企业微信风格 */
.people-count {
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    background: #f7f8fa;
    color: #4e5969;
    border: 1px solid #e5e6eb;
}

.house-item[data-people="low"] .people-count { 
    background: #f6ffed; 
    color: #52c41a; 
    border-color: #b7eb8f;
}
.house-item[data-people="medium"] .people-count { 
    background: #fffbe6; 
    color: #faad14; 
    border-color: #ffe58f;
}
.house-item[data-people="high"] .people-count { 
    background: #fff2e8; 
    color: #ff7a45; 
    border-color: #ffd591;
}
.house-item[data-people="very-high"] .people-count { 
    background: #fff1f0; 
    color: #f5222d; 
    border-color: #ffa39e;
}

.house-actions {
    display: flex;
    gap: 5px;
}

.edit-btn, .add-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 3px;
    font-size: 12px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
}

.edit-btn {
    color: #1a6be0;
    background: #f0f7ff;
    border: 1px solid #d9ecff;
}

.edit-btn:hover {
    background: #e6f3ff;
    border-color: #c0e0ff;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(26, 107, 224, 0.2);
}

.add-btn {
    color: #27ae60;
}

.add-btn:hover {
    background: #e8f6ef;
}

/* 右侧地图样式 */
.map-container {
    flex: 1;
    position: relative;
}

.map {
    width: 100%;
    height: 100%;
}

/* 表单侧边栏样式 */
.form-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    transition: right 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
}

.form-sidebar.open {
    right: 0;
}

.form-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    background: #2c3e50;
    color: white;
    border-bottom: 1px solid #34495e;
}

.form-header h3 {
    margin: 0;
    font-size: 18px;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.close-btn:hover {
    background: rgba(255,255,255,0.1);
}

.house-form {
    padding: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #2c3e50;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input[type="text"]:focus,
.form-group input[type="number"]:focus,
.form-group select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.form-group input[type="checkbox"] {
    margin-right: 8px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 30px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

/* 地图标记样式 */
.marker-label {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: 40%;
    }
    
    .map-container {
        width: 100%;
        height: 60%;
    }
    
    .form-sidebar {
        width: 100%;
        right: -100%;
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}