body, html {
    margin: 0;
    height: 100%;
    overflow: hidden;
    font-family: "Segoe UI", sans-serif;
    background: #f3f3f3;
    display: flex;
    flex-direction: column;
}

/* --- 菜单栏样式 --- */
.menu-item:hover>.dropdown-content:not(.sub-dropdown-content) {
    display: block;
}

#menubar {
    height: 30px;
    background: #333;
    color: white;
    display: flex;
    align-items: center;
    padding: 0;
    flex-shrink: 0;
    user-select: none;
    position: relative;
    z-index: 100;
}

.menu-item {
    padding: 0 12px;
    height: 100%;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: background 0.1s;
    position: relative;
}

.menu-item:hover {
    background: #0078D7;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #f9f9f9;
    min-width: 150px;
    box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
    z-index: 101;
    border: 1px solid #ccc;
}

.dropdown-content button {
    color: black;
    padding: 8px 16px;
    text-decoration: none;
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: 0;
    outline: none;
    cursor: pointer;
    font-size: 14px;
    box-sizing: border-box;
    margin: 0;
}

.dropdown-content button:hover {
    background-color: #ddd;
}

/* --- 主容器样式 --- */
#container {
    display: flex;
    flex-grow: 1;
    position: relative;
}

#propertygrid {
    flex: 0 0 260px;
    min-width: 150px;
    max-width: 600px;
    border-right: 1px solid #c8c8c8;
    padding: 10px;
    box-sizing: border-box;
    background: #f3f3f3;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

#propertygrid h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 16px;
    text-align: left;
}

#propertygrid .row {
    display: flex;
    align-items: center;
    margin: 6px 0;
    gap: 5px;
}

#propertygrid label {
    width: 80px;
    text-align: left;
    font-weight: 500;
    color: #333;
}

#propertygrid input,
#propertygrid select {
    /* 修正对齐和宽度不一致 */
    box-sizing: border-box; 
    width: 155px; 
    
    padding: 4px;
    border: 1px solid #c8c8c8;
    border-radius: 3px;
    background: white;
    color: #333;
}

#splitter {
    width: 5px;
    cursor: ew-resize;
    background: #888;
    flex-shrink: 0;
}

#canvasWrapper {
    flex: 1;
    background: #1e1e1e;
    display: flex;
    position: relative;
}

canvas {
    cursor: grab;
    display: block;
    flex-grow: 1;
}

canvas:active {
    cursor: grabbing;
}

#statusbar {
    height: 25px;
    background: #444;
    color: white;
    padding: 0 10px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    border-top: 1px solid #222;
}

.status-item {
    margin-right: 20px;
    white-space: nowrap;
}

/* 新增：子菜单入口的样式 */
.sub-menu-item {
    padding: 0;
    width: 100%;
    position: relative;
    display: block;
    box-sizing: border-box;
    margin: 0;
    border: 0; /* 强制无边框 */
}

/* 新增：子菜单入口的文本标签样式 (解决对齐和悬停问题) */
.sub-menu-label {
    color: black;
    padding: 8px 16px;
    text-decoration: none;
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    cursor: pointer;
    font-size: 14px;
    box-sizing: border-box;
    margin: 0;
    border: 0; /* 强制无边框 */
}

/* 鼠标悬停在子菜单入口时的样式 */
.sub-menu-item:hover>.sub-menu-label {
    background-color: #ddd;
}

/* 确保二级子菜单悬停时才显示 */
.sub-menu-item:hover>.dropdown-content {
    display: block !important;
}

/* 菜单项悬停时，子菜单文本标签应改变背景色 */
.menu-item.sub-menu-item:hover {
    background: none; /* 移除父级菜单项的默认悬停背景，由 .sub-menu-label 处理 */
}
